summaryrefslogtreecommitdiff
path: root/inline.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-09-14 17:09:51 -0600
committerKarl Williamson <khw@cpan.org>2016-09-17 21:10:50 -0600
commitc41b2540e92ea1e5c8c0019b8a4c085c5fd741e8 (patch)
tree60fe00a6d8bab233d415804d99c0bd5438797085 /inline.h
parent3d56ecbe82b99d21cf2f5e67297d4236e38b282d (diff)
downloadperl-c41b2540e92ea1e5c8c0019b8a4c085c5fd741e8.tar.gz
inline.h: Add 'const's; avoid hiding outer variable
This changes some formal parameters to be const, and avoids reusing the same variable name within an inner block, to avoid confusion
Diffstat (limited to 'inline.h')
-rw-r--r--inline.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/inline.h b/inline.h
index 44fb484d48..d15154f14f 100644
--- a/inline.h
+++ b/inline.h
@@ -290,7 +290,7 @@ non-Unicode code points are allowed.
PERL_STATIC_INLINE UV
Perl_valid_utf8_to_uvchr(const U8 *s, STRLEN *retlen)
{
- UV expectlen = UTF8SKIP(s);
+ const UV expectlen = UTF8SKIP(s);
const U8* send = s + expectlen;
UV uv = *s;
@@ -373,7 +373,7 @@ L</is_utf8_string_loc>().
*/
PERL_STATIC_INLINE bool
-Perl_is_utf8_string(const U8 *s, STRLEN len)
+Perl_is_utf8_string(const U8 *s, const STRLEN len)
{
/* This is now marked pure in embed.fnc, because isUTF8_CHAR now is pure.
* Be aware of possible changes to that */
@@ -384,11 +384,11 @@ Perl_is_utf8_string(const U8 *s, STRLEN len)
PERL_ARGS_ASSERT_IS_UTF8_STRING;
while (x < send) {
- STRLEN len = isUTF8_CHAR(x, send);
- if (UNLIKELY(! len)) {
+ const STRLEN cur_len = isUTF8_CHAR(x, send);
+ if (UNLIKELY(! cur_len)) {
return FALSE;
}
- x += len;
+ x += cur_len;
}
return TRUE;
@@ -418,7 +418,7 @@ See also L</is_utf8_string_loc>() and L</is_utf8_string>().
*/
PERL_STATIC_INLINE bool
-Perl_is_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el)
+Perl_is_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el)
{
const U8* const send = s + (len ? len : strlen((const char *)s));
const U8* x = s;
@@ -427,11 +427,11 @@ Perl_is_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el)
PERL_ARGS_ASSERT_IS_UTF8_STRING_LOCLEN;
while (x < send) {
- STRLEN len = isUTF8_CHAR(x, send);
- if (UNLIKELY(! len)) {
+ const STRLEN cur_len = isUTF8_CHAR(x, send);
+ if (UNLIKELY(! cur_len)) {
break;
}
- x += len;
+ x += cur_len;
outlen++;
}