diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-01-11 13:34:09 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-01-12 20:35:20 -0700 |
commit | 023b68d6beb8f99a100166a98aa63f9851159aee (patch) | |
tree | 3524c2839972f22445f644d964dc2badb7cbc2f6 | |
parent | 4243a48cf94dec7ea8f00d2915320e2d1a2a4632 (diff) | |
download | perl-khw/invlist.tar.gz |
for smokingkhw/invlist
-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); |