This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add MAYBE_DEREF_GV macro
authorFather Chrysostomos <sprout@cpan.org>
Sat, 10 Sep 2011 13:09:26 +0000 (06:09 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 10 Sep 2011 13:43:49 +0000 (06:43 -0700)
commit557fbd17eba6e0db6dab333c82d35234963af435
tree6358eda4d27dec8b83abf5d7a698818c312433ee
parent5e0b4493cc341303b7c3c0606ba927b605e53a62
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 */

   }
pp.h
sv.h