summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorSteve Hay <SteveHay@planit.com>2004-11-16 09:42:50 +0000
committerSteve Hay <SteveHay@planit.com>2004-11-16 09:42:50 +0000
commit4026c95ac795414220d662f764bd6e993724505d (patch)
tree04a79e3b2ce2e22e973f154adbbdeae3c3b9d03e /regcomp.c
parent68ccb645d74feb45c64863c3223051537fbc9fed (diff)
downloadperl-4026c95ac795414220d662f764bd6e993724505d.tar.gz
Fix Win32 breakage caused by changes to op.c in change 23433.
Also limit the scope of the locks in a couple of places, as suggested by Hugo in http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2004-11/msg00286.html. p4raw-id: //depot/perl@23499
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/regcomp.c b/regcomp.c
index 97e81bc728..7b4d647995 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -4967,6 +4967,7 @@ Perl_pregfree(pTHX_ struct regexp *r)
int n = r->data->count;
PAD* new_comppad = NULL;
PAD* old_comppad;
+ PADOFFSET refcnt;
while (--n >= 0) {
/* If you add a ->what type here, update the comment in regcomp.h */
@@ -4989,13 +4990,10 @@ Perl_pregfree(pTHX_ struct regexp *r)
new_comppad : Null(PAD *)
);
OP_REFCNT_LOCK;
- if (!OpREFCNT_dec((OP_4tree*)r->data->data[n])) {
- OP_REFCNT_UNLOCK;
+ refcnt = OpREFCNT_dec((OP_4tree*)r->data->data[n]);
+ OP_REFCNT_UNLOCK;
+ if (!refcnt)
op_free((OP_4tree*)r->data->data[n]);
- }
- else {
- OP_REFCNT_UNLOCK;
- }
PAD_RESTORE_LOCAL(old_comppad);
SvREFCNT_dec((SV*)new_comppad);