summaryrefslogtreecommitdiff
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
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
-rw-r--r--embed.fnc6
-rw-r--r--inline.h18
-rw-r--r--mathoms.c2
-rw-r--r--proto.h6
4 files changed, 16 insertions, 16 deletions
diff --git a/embed.fnc b/embed.fnc
index 3bdc4266b7..983c3acd6c 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -741,9 +741,9 @@ AmnpdRP |bool |is_ascii_string|NN const U8* const s|const STRLEN len
AmnpdRP |bool |is_invariant_string|NN const U8* const s|const STRLEN len
AnpdD |STRLEN |is_utf8_char |NN const U8 *s
Abmnpd |STRLEN |is_utf8_char_buf|NN const U8 *buf|NN const U8 *buf_end
-AnipdP |bool |is_utf8_string |NN const U8 *s|STRLEN len
-Anpdmb |bool |is_utf8_string_loc|NN const U8 *s|STRLEN len|NN const U8 **ep
-Anipd |bool |is_utf8_string_loclen|NN const U8 *s|STRLEN len|NULLOK const U8 **ep|NULLOK STRLEN *el
+AnipdP |bool |is_utf8_string |NN const U8 *s|const STRLEN len
+Anpdmb |bool |is_utf8_string_loc|NN const U8 *s|const STRLEN len|NN const U8 **ep
+Anipd |bool |is_utf8_string_loclen|NN const U8 *s|const STRLEN len|NULLOK const U8 **ep|NULLOK STRLEN *el
AmndP |bool |is_utf8_valid_partial_char \
|NN const U8 * const s|NN const U8 * const e
AnidP |bool |is_utf8_valid_partial_char_flags \
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++;
}
diff --git a/mathoms.c b/mathoms.c
index 1480186f69..a3f20e79f4 100644
--- a/mathoms.c
+++ b/mathoms.c
@@ -690,7 +690,7 @@ Perl_init_i18nl14n(pTHX_ int printwarn)
}
bool
-Perl_is_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep)
+Perl_is_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep)
{
PERL_ARGS_ASSERT_IS_UTF8_STRING_LOC;
diff --git a/proto.h b/proto.h
index b13b42e1e1..f57fb35039 100644
--- a/proto.h
+++ b/proto.h
@@ -1609,17 +1609,17 @@ PERL_CALLCONV bool Perl_is_utf8_space(pTHX_ const U8 *p)
#define PERL_ARGS_ASSERT_IS_UTF8_SPACE \
assert(p)
-PERL_STATIC_INLINE bool Perl_is_utf8_string(const U8 *s, STRLEN len)
+PERL_STATIC_INLINE bool Perl_is_utf8_string(const U8 *s, const STRLEN len)
__attribute__pure__;
#define PERL_ARGS_ASSERT_IS_UTF8_STRING \
assert(s)
#ifndef NO_MATHOMS
-PERL_CALLCONV bool Perl_is_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep);
+PERL_CALLCONV bool Perl_is_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep);
#define PERL_ARGS_ASSERT_IS_UTF8_STRING_LOC \
assert(s); assert(ep)
#endif
-PERL_STATIC_INLINE bool Perl_is_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el);
+PERL_STATIC_INLINE bool Perl_is_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el);
#define PERL_ARGS_ASSERT_IS_UTF8_STRING_LOCLEN \
assert(s)
PERL_CALLCONV bool Perl_is_utf8_upper(pTHX_ const U8 *p)