diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-06-23 09:48:34 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-06-29 00:20:55 -0700 |
commit | bb38a9e0f528ce1ecffe4f8c3c76984148803932 (patch) | |
tree | 7a2a6d40014705c9a079ad16e1cfbae4a040be41 /scope.h | |
parent | bfbc3ad9dfc28552739737eb87f09552732c0e95 (diff) | |
download | perl-bb38a9e0f528ce1ecffe4f8c3c76984148803932.tar.gz |
Flag ops that are on the savestack
This is to allow future commits to free dangling ops after errors.
If an op is on the savestack, then it is going to be freed by scope.c,
and op_free must not be called on it by anyone else.
So we flag such ops new.
Diffstat (limited to 'scope.h')
-rw-r--r-- | scope.h | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -269,7 +269,21 @@ scope has the given name. Name must be a literal string. #define save_freesv(op) save_pushptr((void *)(op), SAVEt_FREESV) #define save_mortalizesv(op) save_pushptr((void *)(op), SAVEt_MORTALIZESV) -#define save_freeop(op) save_pushptr((void *)(op), SAVEt_FREEOP) +#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) +# define save_freeop(op) \ + ({ \ + OP * const _o = (OP *)(op); \ + _o->op_savefree = 1; \ + save_pushptr((void *)(_o), SAVEt_FREEOP); \ + }) +#else +# define save_freeop(op) \ + ( \ + PL_Xpv = (XPV *)(op), \ + ((OP *)PL_Xpv)->op_savefree = 1, \ + save_pushptr((void *)(PL_Xpv), SAVEt_FREEOP) \ + ) +#endif #define save_freepv(pv) save_pushptr((void *)(pv), SAVEt_FREEPV) #define save_op() save_pushptr((void *)(PL_op), SAVEt_OP) |