diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-09-10 06:09:26 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-09-10 06:43:49 -0700 |
commit | 557fbd17eba6e0db6dab333c82d35234963af435 (patch) | |
tree | 6358eda4d27dec8b83abf5d7a698818c312433ee /sv.h | |
parent | 5e0b4493cc341303b7c3c0606ba927b605e53a62 (diff) | |
download | perl-557fbd17eba6e0db6dab333c82d35234963af435.tar.gz |
Add MAYBE_DEREF_GV macro
There are so many parts of the core (mostly pp functions or functions
they call) that need a glob or a globref, including many that call
get-magic at the wrong time (or not at all in some cases, that it
makes sense to add a macro to do it.
It can be used like this:
if (gv = MAYBE_DEREF_GV(sv)) /* calls get-magic */
{
}
else { /* avoid magic here */
}
Diffstat (limited to 'sv.h')
-rw-r--r-- | sv.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1919,7 +1919,7 @@ Returns a pointer to the character buffer. #define SvUNLOCK(sv) PL_unlockhook(aTHX_ sv) #define SvDESTROYABLE(sv) PL_destroyhook(aTHX_ sv) -#define SvGETMAGIC(x) STMT_START { if (SvGMAGICAL(x)) mg_get(x); } STMT_END +#define SvGETMAGIC(x) ((void)(SvGMAGICAL(x) && mg_get(x))) #define SvSETMAGIC(x) STMT_START { if (SvSMAGICAL(x)) mg_set(x); } STMT_END #define SvSetSV_and(dst,src,finally) \ |