summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2017-05-22 15:57:07 +1000
committerKarl Williamson <khw@cpan.org>2022-04-13 09:45:34 -0600
commitd2c620e2b105e34de19834d5e24a3191579d4583 (patch)
treed3ef5e4372e88f219cb378a630611e6902cbaeee /regcomp.c
parent4303fd2da3dda68da2954d68ae885ed9fcba1b5b (diff)
downloadperl-d2c620e2b105e34de19834d5e24a3191579d4583.tar.gz
Make arguments to S_invlist_is_iterating and S_invlist_max be const
Based on a patch originally by Andy Lester
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/regcomp.c b/regcomp.c
index 169272e1dd..577e9bfd7c 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -9487,24 +9487,27 @@ S_invlist_clear(pTHX_ SV* invlist) /* Empty the inversion list */
#endif /* ifndef PERL_IN_XSUB_RE */
PERL_STATIC_INLINE bool
-S_invlist_is_iterating(SV* const invlist)
+S_invlist_is_iterating(const SV* const invlist)
{
PERL_ARGS_ASSERT_INVLIST_IS_ITERATING;
- return *(get_invlist_iter_addr(invlist)) < (STRLEN) UV_MAX;
+ /* get_invlist_iter_addr()'s sv is non-const only because it returns a
+ * value that can be used to modify the invlist, it doesn't modify the
+ * invlist itself */
+ return *(get_invlist_iter_addr((SV*)invlist)) < (STRLEN) UV_MAX;
}
#ifndef PERL_IN_XSUB_RE
PERL_STATIC_INLINE UV
-S_invlist_max(SV* const invlist)
+S_invlist_max(const SV* const invlist)
{
/* Returns the maximum number of elements storable in the inversion list's
* array, without having to realloc() */
PERL_ARGS_ASSERT_INVLIST_MAX;
- assert(is_invlist(invlist));
+ assert(is_invlist((SV *) invlist));
/* Assumes worst case, in which the 0 element is not counted in the
* inversion list, so subtracts 1 for that */