diff options
author | Ben Morrow <ben@morrow.me.uk> | 2009-12-07 11:52:23 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-07-12 10:40:47 +0200 |
commit | 52db365a88f7ab3b9b091f983a05054164499982 (patch) | |
tree | b4c8cfb606ca59bff9d00fd9263e797771fb5e3e /ext | |
parent | 03569ecfc8c82939dcc47b586a8e22c613c158b2 (diff) | |
download | perl-52db365a88f7ab3b9b091f983a05054164499982.tar.gz |
Macroify the block_hooks structure.
Add a flags member, so it can be extended later if necessary. Add a
bhk_eval member, called from doeval to catch requires and string evals.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/XS-APItest/APItest.xs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs index 012102dd3f..54880b73b3 100644 --- a/ext/XS-APItest/APItest.xs +++ b/ext/XS-APItest/APItest.xs @@ -271,17 +271,12 @@ blockhook_pre_end(pTHX_ OP **o) /* if we hit the end of a scope we missed the start of, we need to * unconditionally clear @CSC */ - if (GvAV(MY_CXT.cscgv) == MY_CXT.cscav && MY_CXT.cscav) + if (GvAV(MY_CXT.cscgv) == MY_CXT.cscav && MY_CXT.cscav) { av_clear(MY_CXT.cscav); + } } -STATIC struct block_hooks my_block_hooks = { - blockhook_start, - blockhook_pre_end, - NULL -}; - #include "const-c.inc" MODULE = XS::APItest:Hash PACKAGE = XS::APItest::Hash @@ -634,6 +629,7 @@ PROTOTYPES: DISABLE BOOT: { + BHK *bhk; MY_CXT_INIT; MY_CXT.i = 99; @@ -642,9 +638,13 @@ BOOT: GV_ADD, SVt_PVAV); MY_CXT.cscav = GvAV(MY_CXT.cscgv); + Newxz(bhk, 1, BHK); + BhkENTRY_set(bhk, start, blockhook_start); + BhkENTRY_set(bhk, pre_end, blockhook_pre_end); + if (!PL_blockhooks) PL_blockhooks = newAV(); - av_push(PL_blockhooks, newSViv(PTR2IV(&my_block_hooks))); + av_push(PL_blockhooks, newSViv(PTR2IV(bhk))); } void |