From: Nicholas Clark <nick@ccl4.org>
Date: Wed, 21 Jan 2009 13:36:08 +0000 (+0000)
Subject: Update the documentation of get_av() to note that it calls Perl_gv_fetchpv(),
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cbfd0a879b2bf2ade4a309e6d56c08ba19f320e1;p=p5sagit%2Fp5-mst-13.2.git

Update the documentation of get_av() to note that it calls Perl_gv_fetchpv(),
and hence the 'create' argument is actually 'flags'. Fix code and documentation
that used TRUE or FALSE to use 0 or GV_ADD.
---

diff --git a/embed.fnc b/embed.fnc
index 39623e0..4d86e98 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -773,7 +773,7 @@ Ap	|OP *	|doref		|NN OP *o|I32 type|bool set_op_ref
 Apd	|SV*	|eval_pv	|NN const char* p|I32 croak_on_error
 Apd	|I32	|eval_sv	|NN SV* sv|I32 flags
 Apd	|SV*	|get_sv		|NN const char* name|I32 create
-Apd	|AV*	|get_av		|NN const char* name|I32 create
+Apd	|AV*	|get_av		|NN const char *name|I32 flags
 Apd	|HV*	|get_hv		|NN const char *name|I32 flags
 Apd	|CV*	|get_cv		|NN const char* name|I32 flags
 Apd	|CV*	|get_cvn_flags	|NN const char* name|STRLEN len|I32 flags
diff --git a/ext/B/B.xs b/ext/B/B.xs
index eca6f08..186237f 100644
--- a/ext/B/B.xs
+++ b/ext/B/B.xs
@@ -596,7 +596,7 @@ PROTOTYPES: DISABLE
 BOOT:
 {
     HV *stash = gv_stashpvn("B", 1, GV_ADD);
-    AV *export_ok = perl_get_av("B::EXPORT_OK",TRUE);
+    AV *export_ok = perl_get_av("B::EXPORT_OK", GV_ADD);
     MY_CXT_INIT;
     specialsv_list[0] = Nullsv;
     specialsv_list[1] = &PL_sv_undef;
diff --git a/ext/DynaLoader/dlutils.c b/ext/DynaLoader/dlutils.c
index e9dd34a..3eb1f3d 100644
--- a/ext/DynaLoader/dlutils.c
+++ b/ext/DynaLoader/dlutils.c
@@ -69,7 +69,7 @@ dl_unload_all_files(pTHX_ void *unused)
     SV *dl_libref;
 
     if ((sub = get_cv("DynaLoader::dl_unload_file", FALSE)) != NULL) {
-        dl_librefs = get_av("DynaLoader::dl_librefs", FALSE);
+        dl_librefs = get_av("DynaLoader::dl_librefs", 0);
         while ((dl_libref = av_pop(dl_librefs)) != &PL_sv_undef) {
            dSP;
            ENTER;
diff --git a/perl.c b/perl.c
index 7e56ef5..95848f1 100644
--- a/perl.c
+++ b/perl.c
@@ -2440,21 +2440,22 @@ Perl_get_sv(pTHX_ const char *name, I32 create)
 
 =for apidoc p||get_av
 
-Returns the AV of the specified Perl array.  If C<create> is set and the
-Perl variable does not exist then it will be created.  If C<create> is not
-set and the variable does not exist then NULL is returned.
+Returns the AV of the specified Perl array.  C<flags> are passed to
+C<gv_fetchpv>. If C<GV_ADD> is set and the
+Perl variable does not exist then it will be created.  If C<flags> is zero
+and the variable does not exist then NULL is returned.
 
 =cut
 */
 
 AV*
-Perl_get_av(pTHX_ const char *name, I32 create)
+Perl_get_av(pTHX_ const char *name, I32 flags)
 {
-    GV* const gv = gv_fetchpv(name, create, SVt_PVAV);
+    GV* const gv = gv_fetchpv(name, flags, SVt_PVAV);
 
     PERL_ARGS_ASSERT_GET_AV;
 
-    if (create)
+    if (flags)
     	return GvAVn(gv);
     if (gv)
 	return GvAV(gv);
@@ -4732,7 +4733,7 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register
 
     /* touch @F array to prevent spurious warnings 20020415 MJD */
     if (PL_minus_a) {
-      (void) get_av("main::F", TRUE | GV_ADDMULTI);
+      (void) get_av("main::F", GV_ADD | GV_ADDMULTI);
     }
 }
 
diff --git a/pod/perlapi.pod b/pod/perlapi.pod
index f51bd96..02e5f26 100644
--- a/pod/perlapi.pod
+++ b/pod/perlapi.pod
@@ -354,13 +354,14 @@ Found in file av.c
 =item get_av
 X<get_av>
 
-Returns the AV of the specified Perl array.  If C<create> is set and the
-Perl variable does not exist then it will be created.  If C<create> is not
-set and the variable does not exist then NULL is returned.
+Returns the AV of the specified Perl array.  C<flags> are passed to
+C<gv_fetchpv>. If C<GV_ADD> is set and the
+Perl variable does not exist then it will be created.  If C<flags> is zero
+and the variable does not exist then NULL is returned.
 
 NOTE: the perl_ form of this function is deprecated.
 
-	AV*	get_av(const char* name, I32 create)
+	AV*	get_av(const char *name, I32 flags)
 
 =for hackers
 Found in file perl.c
diff --git a/pod/perlembed.pod b/pod/perlembed.pod
index 2466531..a2b76fd 100644
--- a/pod/perlembed.pod
+++ b/pod/perlembed.pod
@@ -480,7 +480,7 @@ been wrapped here):
      my_eval_sv(command, TRUE);
      SvREFCNT_dec(command);
 
-     *match_list = get_av("array", FALSE);
+     *match_list = get_av("array", 0);
      num_matches = av_len(*match_list) + 1; /** assume $[ is 0 **/
 
      return num_matches;
diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 6d64c13..8231592 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -367,7 +367,7 @@ then nothing is done.
 If you know the name of an array variable, you can get a pointer to its AV
 by using the following:
 
-    AV*  get_av("package::varname", FALSE);
+    AV*  get_av("package::varname", 0);
 
 This returns NULL if the variable does not exist.
 
@@ -668,7 +668,7 @@ To create a new Perl variable with an undef value which can be accessed from
 your Perl script, use the following routines, depending on the variable type.
 
     SV*  get_sv("package::varname", TRUE);
-    AV*  get_av("package::varname", TRUE);
+    AV*  get_av("package::varname", GV_ADD);
     HV*  get_hv("package::varname", GV_ADD);
 
 Notice the use of TRUE as the second parameter.  The new variable can now
diff --git a/proto.h b/proto.h
index e523d17..e50ae92 100644
--- a/proto.h
+++ b/proto.h
@@ -2429,7 +2429,7 @@ PERL_CALLCONV SV*	Perl_get_sv(pTHX_ const char* name, I32 create)
 #define PERL_ARGS_ASSERT_GET_SV	\
 	assert(name)
 
-PERL_CALLCONV AV*	Perl_get_av(pTHX_ const char* name, I32 create)
+PERL_CALLCONV AV*	Perl_get_av(pTHX_ const char *name, I32 flags)
 			__attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_GET_AV	\
 	assert(name)