diff options
author | Karl Williamson <public@khwilliamson.com> | 2013-07-23 09:25:36 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-07-23 09:54:16 -0600 |
commit | f49d80741c9b7322c31473ee711d466d875ac060 (patch) | |
tree | d6ffe9de025511dffc5150b0d4adb5af0eeb7fdb /inline_invlist.c | |
parent | 4320851cd57948e3e528ddb2ea5adc8e2d873271 (diff) | |
download | perl-f49d80741c9b7322c31473ee711d466d875ac060.tar.gz |
regcomp.c: Add some asserts()
Now that inversion lists are their own scalar types, we can verify that
the parameters to their manipulation functions are indeed inversion
lists. This adds such assertions to the bottom level code that deals
with the bare metal of the scalars. Functions that call these (even if
only in other asserts) didn't have asserts added to them, as they call
these anyway.
Diffstat (limited to 'inline_invlist.c')
-rw-r--r-- | inline_invlist.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/inline_invlist.c b/inline_invlist.c index 470659bea8..1aea9f7258 100644 --- a/inline_invlist.c +++ b/inline_invlist.c @@ -25,6 +25,8 @@ S_get_invlist_offset_addr(pTHX_ SV* invlist) PERL_ARGS_ASSERT_GET_INVLIST_OFFSET_ADDR; + assert(SvTYPE(invlist) == SVt_INVLIST); + return &(((XINVLIST*) SvANY(invlist))->is_offset); } @@ -36,6 +38,8 @@ S__invlist_len(pTHX_ SV* const invlist) PERL_ARGS_ASSERT__INVLIST_LEN; + assert(SvTYPE(invlist) == SVt_INVLIST); + return (SvCUR(invlist) == 0) ? 0 : FROM_INTERNAL_SIZE(SvCUR(invlist)) - *get_invlist_offset_addr(invlist); |