diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-04-12 22:45:12 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-04-12 22:45:12 +0000 |
commit | 72dc9ed5af65c946f73050becea29207a1af86c1 (patch) | |
tree | 77d02ca4340063d7184142085f9527f83a40992e /warnings.h | |
parent | aa283a383ef6540d57dd786b93d8ba9bd303e3e6 (diff) | |
download | perl-72dc9ed5af65c946f73050becea29207a1af86c1.tar.gz |
Change cop_warnings from an SV holding the warnings bitmask to a
directly (shared) malloc()ed buffer holding the warnings bitmask.
This avoids bugs/crashes when the interpreter that created an optree
is freed but the optree remains in use by other interpreters.
p4raw-id: //depot/perl@27779
Diffstat (limited to 'warnings.h')
-rw-r--r-- | warnings.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/warnings.h b/warnings.h index 7ef3c0495c..aa830c05fe 100644 --- a/warnings.h +++ b/warnings.h @@ -18,8 +18,8 @@ #define G_WARN_ALL_MASK (G_WARN_ALL_ON|G_WARN_ALL_OFF) #define pWARN_STD NULL -#define pWARN_ALL (((SV*)0)+1) /* use warnings 'all' */ -#define pWARN_NONE (((SV*)0)+2) /* no warnings 'all' */ +#define pWARN_ALL (((STRLEN*)0)+1) /* use warnings 'all' */ +#define pWARN_NONE (((STRLEN*)0)+2) /* no warnings 'all' */ #define specialWARN(x) ((x) == pWARN_STD || (x) == pWARN_ALL || \ (x) == pWARN_NONE) @@ -85,8 +85,12 @@ #define isLEXWARN_on (PL_curcop->cop_warnings != pWARN_STD) #define isLEXWARN_off (PL_curcop->cop_warnings == pWARN_STD) #define isWARN_ONCE (PL_dowarn & (G_WARN_ON|G_WARN_ONCE)) -#define isWARN_on(c,x) (IsSet(SvPVX_const(c), 2*(x))) -#define isWARNf_on(c,x) (IsSet(SvPVX_const(c), 2*(x)+1)) +#define isWARN_on(c,x) (IsSet((U8 *)(c + 1), 2*(x))) +#define isWARNf_on(c,x) (IsSet((U8 *)(c + 1), 2*(x)+1)) + +#define DUP_WARNINGS(p) \ + specialWARN(p) ? (p) \ + : CopyD(p, PerlMemShared_malloc(sizeof(*p)+*p), sizeof(*p)+*p, char) #define ckWARN(w) Perl_ckwarn(aTHX_ packWARN(w)) #define ckWARN2(w1,w2) Perl_ckwarn(aTHX_ packWARN2(w1,w2)) |