summaryrefslogtreecommitdiff
path: root/cop.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-04-08 20:25:52 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-04-19 20:09:11 -0700
commit6379d4a9afb32e86e55704579c9ac81237309672 (patch)
tree885d2dca15b39a4dc91bf9b5bbd3ac8609eea01d /cop.h
parent862504fb08ed24a37a327d325e83ceac76cf05cf (diff)
downloadperl-6379d4a9afb32e86e55704579c9ac81237309672.tar.gz
[perl #112316] Make strict vars respect assignment from null pkg
Under threads, strict vars was not respecting glob assignment from a package with a null in its name if the name of the package assigned to was equal to the prefix of the current package up to the null.
Diffstat (limited to 'cop.h')
-rw-r--r--cop.h35
1 files changed, 21 insertions, 14 deletions
diff --git a/cop.h b/cop.h
index 8690494f42..0cfeb44714 100644
--- a/cop.h
+++ b/cop.h
@@ -389,7 +389,7 @@ struct cop {
#ifdef USE_ITHREADS
char * cop_stashpv; /* package line was compiled in */
char * cop_file; /* file name the following line # is from */
- U32 cop_stashflags; /* currently only SVf_UTF8 */
+ I32 cop_stashlen; /* negative for UTF8 */
#else
HV * cop_stash; /* package line was compiled in */
GV * cop_filegv; /* file the following line # is from */
@@ -429,25 +429,32 @@ struct cop {
# define CopSTASHPV(c) ((c)->cop_stashpv)
# ifdef NETWARE
-# define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = ((pv) ? savepv(pv) : NULL))
+# define CopSTASHPV_set(c,pv,n) ((c)->cop_stashpv = \
+ ((pv) ? savepvn(pv,n) : NULL))
# else
-# define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = savesharedpv(pv))
+# define CopSTASHPV_set(c,pv,n) ((c)->cop_stashpv = (pv) \
+ ? savesharedpvn(pv,n) : NULL)
# endif
-# define CopSTASH_flags(c) ((c)->cop_stashflags)
-# define CopSTASH_flags_set(c,flags) ((c)->cop_stashflags = flags)
+# define CopSTASH_len_set(c,n) ((c)->cop_stashlen = (n))
+# define CopSTASH_len(c) ((c)->cop_stashlen)
# define CopSTASH(c) (CopSTASHPV(c) \
- ? gv_stashpv(CopSTASHPV(c), \
- GV_ADD|(CopSTASH_flags(c) \
- ? CopSTASH_flags(c): 0 )) \
+ ? gv_stashpvn(CopSTASHPV(c), \
+ CopSTASH_len(c) < 0 \
+ ? -CopSTASH_len(c) \
+ : CopSTASH_len(c), \
+ GV_ADD|SVf_UTF8*(CopSTASH_len(c) < 0) \
+ ) \
: NULL)
-# define CopSTASH_set(c,hv) (CopSTASHPV_set(c, (hv) ? HvNAME_get(hv) : NULL), \
- CopSTASH_flags_set(c, \
- ((hv) && HvNAME_HEK(hv) && \
- HvNAMEUTF8(hv)) \
- ? SVf_UTF8 \
- : 0))
+# define CopSTASH_set(c,hv) (CopSTASHPV_set(c, \
+ (hv) ? HvNAME_get(hv) : NULL, \
+ (hv) ? HvNAMELEN(hv) : 0), \
+ CopSTASH_len_set(c, \
+ (hv) ? HvNAMEUTF8(hv) \
+ ? -HvNAMELEN(hv) \
+ : HvNAMELEN(hv) \
+ : 0))
# define CopSTASH_eq(c,hv) ((hv) && stashpv_hvname_match(c,hv))
# ifdef NETWARE
# define CopSTASH_free(c) SAVECOPSTASH_FREE(c)