diff options
-rw-r--r-- | regcomp.c | 43 |
1 files changed, 21 insertions, 22 deletions
@@ -10350,34 +10350,33 @@ parseit: /* Invert if asking for the complement */ if (value == 'P') { - invlist = invlist_clone(invlist); - _invlist_invert(invlist); + + + /* Add to any existing list */ + if (! properties) { + properties = invlist_clone(invlist); + _invlist_invert(properties); + } + else { + invlist = invlist_clone(invlist); + _invlist_invert(invlist); + _invlist_union(properties, invlist, &properties); + SvREFCNT_dec(invlist); + } /* The swash can't be used as-is, because we've - * inverted things */ + * inverted things; delay removing it to here after + * have copied its invlist above */ SvREFCNT_dec(swash); swash = NULL; } else { - /* The invlist fetched from the returned swash - * should not be garbage collected here, but other - * inversion lists created by this routine should - * be. The other clause of this 'if' cloned the - * returned one, thus becoming one that should be - * garbage collected. But that's not the case - * here, so we increment the reference count so - * that later code doesn't have to know the - * difference */ - SvREFCNT_inc(invlist); - } - - /* Add to any existing list */ - if (! properties) { - properties = invlist; - } - else { - _invlist_union(properties, invlist, &properties); - SvREFCNT_dec(invlist); + if (! properties) { + properties = invlist_clone(invlist); + } + else { + _invlist_union(properties, invlist, &properties); + } } } Safefree(name); |