summaryrefslogtreecommitdiff
path: root/pp.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-09-10 18:39:12 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-09-10 19:38:25 -0700
commit094a3eec8ad4cfb12d72a98f11e9186594579b57 (patch)
tree406c76025535d3bc8e1c890b465905f46a37314c /pp.h
parent63d661c578abce858318b675580f163d201925a0 (diff)
downloadperl-094a3eec8ad4cfb12d72a98f11e9186594579b57.tar.gz
Make filetest ops handle get-magic correctly for glob(ref)s
This patch uses the recently-added MAYBE_DEREF_GV macro which puts the glob deref logic in one spot. It also adds _nomg and _flags varia- tions of it. _flags understands the SV_GMAGIC flag.
Diffstat (limited to 'pp.h')
-rw-r--r--pp.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/pp.h b/pp.h
index 23636cc31e..ad71668fab 100644
--- a/pp.h
+++ b/pp.h
@@ -505,9 +505,9 @@ True if this op will be the return value of an lvalue subroutine
# define TIED_METHOD_SAY 0x10
/* Used in various places that need to dereference a glob or globref */
-# define MAYBE_DEREF_GV(sv) \
+# define MAYBE_DEREF_GV_flags(sv,phlags) \
( \
- SvGETMAGIC(sv), \
+ (void)(phlags & SV_GMAGIC && (SvGETMAGIC(sv),0)), \
isGV_with_GP(sv) \
? (GV *)sv \
: SvROK(sv) && SvTYPE(SvRV(sv)) <= SVt_PVLV && \
@@ -515,6 +515,8 @@ True if this op will be the return value of an lvalue subroutine
? (GV *)SvRV(sv) \
: NULL \
)
+# define MAYBE_DEREF_GV(sv) MAYBE_DEREF_GV_flags(sv,SV_GMAGIC)
+# define MAYBE_DEREF_GV_nomg(sv) MAYBE_DEREF_GV_flags(sv,0)
#endif