diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-09-08 20:45:20 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-09-08 21:36:40 -0700 |
commit | 77cb3b015781b8e3c7ee73c313ba18cd16dfb442 (patch) | |
tree | b5b8ecc07baf116844af218e14590a0c655af2f3 /gv.h | |
parent | b1b24ee7afadda660049b2e5ed5e566d8d3babbc (diff) | |
download | perl-77cb3b015781b8e3c7ee73c313ba18cd16dfb442.tar.gz |
Enter gv_fetchsv_nomg
There are so many cases that use this incantation to get around
gv_fetchsv’s calling of get-magic--
STRLEN len;
const char *name = SvPV_nomg_const(sv,len);
gv = gv_fetchpvn_flags(name, len, flags | SvUTF8(sv), type);
--that it’s about time we had a shorthand.
Diffstat (limited to 'gv.h')
-rw-r--r-- | gv.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -214,13 +214,15 @@ Return the SV from the GV. #define GV_AUTOLOAD 0x100 /* gv_fetchmethod_flags() should AUTOLOAD */ #define GV_CROAK 0x200 /* gv_fetchmethod_flags() should croak */ #define GV_ADDMG 0x400 /* add if magical */ +#define GV_NO_SVGMAGIC 0x800 /* Skip get-magic on an SV argument; + used only by gv_fetchsv(_nomg) */ /* SVf_UTF8 (more accurately the return value from SvUTF8) is also valid as a flag to gv_fetch_pvn_flags, so ensure it lies outside this range. */ #define GV_NOADD_MASK \ - (SVf_UTF8|GV_NOADD_NOINIT|GV_NOEXPAND|GV_NOTQUAL|GV_ADDMG) + (SVf_UTF8|GV_NOADD_NOINIT|GV_NOEXPAND|GV_NOTQUAL|GV_ADDMG|GV_NO_SVGMAGIC) /* The bit flags that don't cause gv_fetchpv() to add a symbol if not found (with the exception GV_ADDMG, which *might* cause the symbol to be added) */ @@ -228,6 +230,7 @@ Return the SV from the GV. #define gv_fullname3(sv,gv,prefix) gv_fullname4(sv,gv,prefix,TRUE) #define gv_efullname3(sv,gv,prefix) gv_efullname4(sv,gv,prefix,TRUE) #define gv_fetchmethod(stash, name) gv_fetchmethod_autoload(stash, name, TRUE) +#define gv_fetchsv_nomg(n,f,t) gv_fetchsv(n,(f)|GV_NO_SVGMAGIC,t) #define gv_AVadd(gv) gv_add_by_type((gv), SVt_PVAV) #define gv_HVadd(gv) gv_add_by_type((gv), SVt_PVHV) |