summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-01-21 12:12:12 +0000
committerNicholas Clark <nick@ccl4.org>2009-01-21 17:09:11 +0000
commit6673a63c63e2a65dbfcc835d6499cc97c449c67b (patch)
treeec84eaad20d1a2dae1ca297ecf1d19de05feff1f
parent2b393bf410d9f1bf0b80132c4e8b5d6707a139f8 (diff)
downloadperl-6673a63c63e2a65dbfcc835d6499cc97c449c67b.tar.gz
Update the documentation of get_hv() 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.
-rw-r--r--embed.fnc2
-rw-r--r--mg.c2
-rw-r--r--perl.c13
-rw-r--r--pod/perlapi.pod9
-rw-r--r--pod/perlguts.pod4
-rw-r--r--pp_ctl.c2
-rw-r--r--proto.h2
-rw-r--r--utf8.c2
8 files changed, 19 insertions, 17 deletions
diff --git a/embed.fnc b/embed.fnc
index 4a9d6ce1dd..39623e0c33 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -774,7 +774,7 @@ 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 |HV* |get_hv |NN const char* name|I32 create
+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
Ap |int |init_i18nl10n |int printwarn
diff --git a/mg.c b/mg.c
index 7acff5190f..c94f50eb8e 100644
--- a/mg.c
+++ b/mg.c
@@ -904,7 +904,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
else if (PL_compiling.cop_warnings == pWARN_ALL) {
/* Get the bit mask for $warnings::Bits{all}, because
* it could have been extended by warnings::register */
- HV * const bits=get_hv("warnings::Bits", FALSE);
+ HV * const bits=get_hv("warnings::Bits", 0);
if (bits) {
SV ** const bits_all = hv_fetchs(bits, "all", FALSE);
if (bits_all)
diff --git a/perl.c b/perl.c
index d02514ca7a..7e56ef538c 100644
--- a/perl.c
+++ b/perl.c
@@ -2466,21 +2466,22 @@ Perl_get_av(pTHX_ const char *name, I32 create)
=for apidoc p||get_hv
-Returns the HV of the specified Perl hash. 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 HV of the specified Perl hash. 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
*/
HV*
-Perl_get_hv(pTHX_ const char *name, I32 create)
+Perl_get_hv(pTHX_ const char *name, I32 flags)
{
- GV* const gv = gv_fetchpv(name, create, SVt_PVHV);
+ GV* const gv = gv_fetchpv(name, flags, SVt_PVHV);
PERL_ARGS_ASSERT_GET_HV;
- if (create)
+ if (flags)
return GvHVn(gv);
if (gv)
return GvHV(gv);
diff --git a/pod/perlapi.pod b/pod/perlapi.pod
index 8c3e6d6bb6..f51bd96bfb 100644
--- a/pod/perlapi.pod
+++ b/pod/perlapi.pod
@@ -1484,13 +1484,14 @@ Found in file handy.h
=item get_hv
X<get_hv>
-Returns the HV of the specified Perl hash. 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 HV of the specified Perl hash. 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.
- HV* get_hv(const char* name, I32 create)
+ HV* get_hv(const char *name, I32 flags)
=for hackers
Found in file perl.c
diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 3ce60d0599..6d64c1352c 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -442,7 +442,7 @@ specified below.
If you know the name of a hash variable, you can get a pointer to its HV
by using the following:
- HV* get_hv("package::varname", FALSE);
+ HV* get_hv("package::varname", 0);
This returns NULL if the variable does not exist.
@@ -669,7 +669,7 @@ your Perl script, use the following routines, depending on the variable type.
SV* get_sv("package::varname", TRUE);
AV* get_av("package::varname", TRUE);
- HV* get_hv("package::varname", TRUE);
+ HV* get_hv("package::varname", GV_ADD);
Notice the use of TRUE as the second parameter. The new variable can now
be set, using the routines appropriate to the data type.
diff --git a/pp_ctl.c b/pp_ctl.c
index 799683d059..8af388f5ba 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1778,7 +1778,7 @@ PP(pp_caller)
/* Get the bit mask for $warnings::Bits{all}, because
* it could have been extended by warnings::register */
SV **bits_all;
- HV * const bits = get_hv("warnings::Bits", FALSE);
+ HV * const bits = get_hv("warnings::Bits", 0);
if (bits && (bits_all=hv_fetchs(bits, "all", FALSE))) {
mask = newSVsv(*bits_all);
}
diff --git a/proto.h b/proto.h
index a0dfbbfcad..e523d1794e 100644
--- a/proto.h
+++ b/proto.h
@@ -2434,7 +2434,7 @@ PERL_CALLCONV AV* Perl_get_av(pTHX_ const char* name, I32 create)
#define PERL_ARGS_ASSERT_GET_AV \
assert(name)
-PERL_CALLCONV HV* Perl_get_hv(pTHX_ const char* name, I32 create)
+PERL_CALLCONV HV* Perl_get_hv(pTHX_ const char *name, I32 flags)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_GET_HV \
assert(name)
diff --git a/utf8.c b/utf8.c
index 8243793959..4f4c3eaffe 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1498,7 +1498,7 @@ Perl_to_utf8_case(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp,
if (special && (uv1 == 0xDF || uv1 > 0xFF)) {
/* It might be "special" (sometimes, but not always,
* a multicharacter mapping) */
- HV * const hv = get_hv(special, FALSE);
+ HV * const hv = get_hv(special, 0);
SV **svp;
if (hv &&