summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-12-28 22:01:30 +0000
committerNicholas Clark <nick@ccl4.org>2007-12-28 22:01:30 +0000
commit3a9b2cacfb08e1181b7d9ae45cad1ed8acd59972 (patch)
treecd9ff46e897db2880acc522eb4ff1f1b8fa55903 /regcomp.c
parent220fc49f9cd19ab777a22ef733671f0fbb81e6bd (diff)
downloadperl-3a9b2cacfb08e1181b7d9ae45cad1ed8acd59972.tar.gz
Silly Nick. There was a bug in change 30757 whereby the precomp of a
dup'd regexp would be pointing somewhere la-la. Probably at the precomp of the same regexp in the parent thread. (So it is only likely to go nasal daemon if the parent thread terminates first, or explicitly goes around freeing up run time generated regexps.) p4raw-id: //depot/perl@32754
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index 9732086110..544bbbc9d0 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -9371,6 +9371,7 @@ Perl_re_dup(pTHX_ const regexp *r, CLONE_PARAMS *param)
dVAR;
regexp *ret;
I32 npar;
+ U32 precomp_offset;
if (!r)
return (REGEXP *)NULL;
@@ -9419,8 +9420,10 @@ Perl_re_dup(pTHX_ const regexp *r, CLONE_PARAMS *param)
}
}
+ precomp_offset = RX_PRECOMP(ret) - ret->wrapped;
+
ret->wrapped = SAVEPVN(ret->wrapped, ret->wraplen+1);
- RX_PRECOMP(ret) = ret->wrapped + (RX_PRECOMP(ret) - ret->wrapped);
+ RX_PRECOMP(ret) = ret->wrapped + precomp_offset;
ret->paren_names = hv_dup_inc(ret->paren_names, param);
if (ret->pprivate)