diff options
author | Karl Williamson <khw@cpan.org> | 2016-09-14 17:09:51 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-09-17 21:10:50 -0600 |
commit | c41b2540e92ea1e5c8c0019b8a4c085c5fd741e8 (patch) | |
tree | 60fe00a6d8bab233d415804d99c0bd5438797085 | |
parent | 3d56ecbe82b99d21cf2f5e67297d4236e38b282d (diff) | |
download | perl-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.fnc | 6 | ||||
-rw-r--r-- | inline.h | 18 | ||||
-rw-r--r-- | mathoms.c | 2 | ||||
-rw-r--r-- | proto.h | 6 |
4 files changed, 16 insertions, 16 deletions
@@ -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 \ @@ -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++; } @@ -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; @@ -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) |