diff options
author | Brian Fraser <fraserbn@gmail.com> | 2011-07-05 00:13:02 -0300 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-10-06 13:00:56 -0700 |
commit | 0eaf81c53c0965e619d33cdd6a5f53c2f4bed7cf (patch) | |
tree | 2f114a86631b478057451b86a1ec60324ec91527 /cop.h | |
parent | f246260499cb1d0203cb449bbdf048074a0126a9 (diff) | |
download | perl-0eaf81c53c0965e619d33cdd6a5f53c2f4bed7cf.tar.gz |
Groundwork to allow cops and pmops to store the UTF8 flag
With threaded builds, cop.h and op.h get an extra member in their
structs, to save the UTF-8ness of the stash's name.
*STASH_set() checks for the flag, stores it through
*STASH_flags(), and *STASH() uses the latter to fetch the
correct scalar.
Diffstat (limited to 'cop.h')
-rw-r--r-- | cop.h | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -389,6 +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 */ #else HV * cop_stash; /* package line was compiled in */ GV * cop_filegv; /* file the following line # is from */ @@ -433,9 +434,20 @@ struct cop { # define CopSTASHPV_set(c,pv) ((c)->cop_stashpv = savesharedpv(pv)) # endif -# define CopSTASH(c) (CopSTASHPV(c) \ - ? gv_stashpv(CopSTASHPV(c),GV_ADD) : NULL) -# define CopSTASH_set(c,hv) CopSTASHPV_set(c, (hv) ? HvNAME_get(hv) : NULL) +# define CopSTASH_flags(c) ((c)->cop_stashflags) +# define CopSTASH_flags_set(c,flags) ((c)->cop_stashflags = flags) + +# define CopSTASH(c) (CopSTASHPV(c) \ + ? gv_stashpv(CopSTASHPV(c), \ + GV_ADD|(CopSTASH_flags(c) \ + ? CopSTASH_flags(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_eq(c,hv) ((hv) && stashpv_hvname_match(c,hv)) # ifdef NETWARE # define CopSTASH_free(c) SAVECOPSTASH_FREE(c) |