regcomp.c: Add some assertions
authorKarl Williamson <public@khwilliamson.com>
Mon, 28 Nov 2011 03:49:59 +0000 (20:49 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 13 Jan 2012 16:58:35 +0000 (09:58 -0700)
Subsequent code assumes that these are true

regcomp.c

index fac23f5..96bb92a 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -6308,6 +6308,7 @@ Perl__invlist_union(pTHX_ SV* const a, SV* const b, SV** output)
     UV count = 0;
 
     PERL_ARGS_ASSERT__INVLIST_UNION;
+    assert(a != b);
 
     /* If either one is empty, the union is the other one */
     len_a = invlist_len(a);
@@ -6494,6 +6495,7 @@ Perl__invlist_intersection(pTHX_ SV* const a, SV* const b, SV** i)
     UV count = 0;
 
     PERL_ARGS_ASSERT__INVLIST_INTERSECTION;
+    assert(a != b);
 
     /* If either one is empty, the intersection is null */
     len_a = invlist_len(a);
@@ -6772,6 +6774,7 @@ Perl__invlist_subtract(pTHX_ SV* const a, SV* const b, SV** result)
      * <a> that aren't also in <b> */
 
     PERL_ARGS_ASSERT__INVLIST_SUBTRACT;
+    assert(a != b);
 
     /* Subtracting nothing retains the original */
     if (invlist_len(b) == 0) {