This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
use new cleanup for PL_regmatch_state
authorDavid Mitchell <davem@iabyn.com>
Thu, 30 May 2013 22:44:53 +0000 (23:44 +0100)
committerDavid Mitchell <davem@iabyn.com>
Sun, 2 Jun 2013 21:28:53 +0000 (22:28 +0100)
commit331b2dcc3fd1fd971f7a6ed1192c36ceaa0d6a88
treed08aaa8da34abe810163dd16a494b4af38c390d8
parentbf2039a952dec80d770a6793104c0280373be103
use new cleanup for PL_regmatch_state

The previous commit reorganised state save and cleanup at the end of regex
execution. Use this new mechanism, by recording the original values
of PL_regmatch_slab and PL_regmatch_state in the regmatch_info_aux struct,
and restoring them and freeing higher slabs as part of the general
S_cleanup_regmatch_info_aux() destructor, rather than pushing the old
values directly onto the savestack and using another specific destructor.

Also, make the initial allocating of (up to) 3 PL_regmatch_state slots
more efficient by doing it in a loop.

We also skip the first slot; this may already be in use if we're called
reentrantly.

try 1
regexec.c
regexp.h