summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cop.h18
-rw-r--r--op.h25
2 files changed, 33 insertions, 10 deletions
diff --git a/cop.h b/cop.h
index 83c86980ba..626feee927 100644
--- a/cop.h
+++ b/cop.h
@@ -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)
diff --git a/op.h b/op.h
index 6ae8dd94d0..02b6652709 100644
--- a/op.h
+++ b/op.h
@@ -351,7 +351,10 @@ struct pmop {
union {
OP * op_pmreplstart; /* Only used in OP_SUBST */
#ifdef USE_ITHREADS
- char * op_pmstashpv; /* Only used in OP_MATCH, with PMf_ONCE set */
+ struct {
+ char * op_pmstashpv; /* Only used in OP_MATCH, with PMf_ONCE set */
+ U32 op_pmstashflags; /* currently only SVf_UTF8 or 0 */
+ } op_pmstashthr;
#else
HV * op_pmstash;
#endif
@@ -421,19 +424,27 @@ struct pmop {
#ifdef USE_ITHREADS
# define PmopSTASHPV(o) \
- (((o)->op_pmflags & PMf_ONCE) ? (o)->op_pmstashstartu.op_pmstashpv : NULL)
+ (((o)->op_pmflags & PMf_ONCE) ? (o)->op_pmstashstartu.op_pmstashthr.op_pmstashpv : NULL)
# if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
# define PmopSTASHPV_set(o,pv) ({ \
assert((o)->op_pmflags & PMf_ONCE); \
- ((o)->op_pmstashstartu.op_pmstashpv = savesharedpv(pv)); \
+ ((o)->op_pmstashstartu.op_pmstashthr.op_pmstashpv = savesharedpv(pv)); \
})
# else
# define PmopSTASHPV_set(o,pv) \
- ((o)->op_pmstashstartu.op_pmstashpv = savesharedpv(pv))
+ ((o)->op_pmstashstartu.op_pmstashthr.op_pmstashpv = savesharedpv(pv))
# endif
-# define PmopSTASH(o) (PmopSTASHPV(o) \
- ? gv_stashpv((o)->op_pmstashstartu.op_pmstashpv,GV_ADD) : NULL)
-# define PmopSTASH_set(o,hv) PmopSTASHPV_set(o, ((hv) ? HvNAME_get(hv) : NULL))
+# define PmopSTASH_flags(o) ((o)->op_pmstashstartu.op_pmstashthr.op_pmstashflags)
+# define PmopSTASH_flags_set(o,flags) ((o)->op_pmstashstartu.op_pmstashthr.op_pmstashflags = flags)
+# define PmopSTASH(o) (PmopSTASHPV(o) \
+ ? gv_stashpv((o)->op_pmstashstartu.op_pmstashthr.op_pmstashpv, \
+ GV_ADD | PmopSTASH_flags(o)) : NULL)
+# define PmopSTASH_set(o,hv) (PmopSTASHPV_set(o, (hv) ? HvNAME_get(hv) : NULL), \
+ PmopSTASH_flags_set(o, \
+ ((hv) && HvNAME_HEK(hv) && \
+ HvNAMEUTF8(hv)) \
+ ? SVf_UTF8 \
+ : 0))
# define PmopSTASH_free(o) PerlMemShared_free(PmopSTASHPV(o))
#else