|STRLEN len \
|NULLOK const U8 ** ep
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
+AmnpdRP |bool |is_invariant_string|NN const U8* const s|STRLEN len
#if defined(PERL_CORE) || defined (PERL_EXT)
EXnidR |bool |is_utf8_non_invariant_string|NN const U8* const s \
|STRLEN len
AnmdpR |bool |is_strict_utf8_string|NN const U8 *s|STRLEN len
AnmdpR |bool |is_c9strict_utf8_string|NN const U8 *s|STRLEN len
Anpdmb |bool |is_utf8_string_loc \
- |NN const U8 *s|const STRLEN len|NN const U8 **ep
+ |NN const U8 *s|STRLEN len|NN const U8 **ep
Andm |bool |is_utf8_string_loc_flags \
|NN const U8 *s|STRLEN len|NN const U8 **ep \
|const U32 flags
Andm |bool |is_strict_utf8_string_loc \
- |NN const U8 *s|const STRLEN len|NN const U8 **ep
+ |NN const U8 *s|STRLEN len|NN const U8 **ep
Andm |bool |is_c9strict_utf8_string_loc \
- |NN const U8 *s|const STRLEN len|NN const U8 **ep
+ |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
|NN const U8 *s|STRLEN len|NULLOK const U8 **ep \
|NULLOK STRLEN *el|const U32 flags
Anid |bool |is_strict_utf8_string_loclen \
- |NN const U8 *s|const STRLEN len|NULLOK const U8 **ep \
+ |NN const U8 *s|STRLEN len|NULLOK const U8 **ep \
|NULLOK STRLEN *el
Anid |bool |is_c9strict_utf8_string_loclen \
- |NN const U8 *s|const STRLEN len|NULLOK const U8 **ep \
+ |NN const U8 *s|STRLEN len|NULLOK const U8 **ep \
|NULLOK STRLEN *el
Amnd |bool |is_utf8_fixed_width_buf_flags \
- |NN const U8 * const s|const STRLEN len|const U32 flags
+ |NN const U8 * const s|STRLEN len|const U32 flags
Amnd |bool |is_utf8_fixed_width_buf_loc_flags \
- |NN const U8 * const s|const STRLEN len \
+ |NN const U8 * const s|STRLEN len \
|NULLOK const U8 **ep|const U32 flags
Anid |bool |is_utf8_fixed_width_buf_loclen_flags \
- |NN const U8 * const s|const STRLEN len \
+ |NN const U8 * const s|STRLEN len \
|NULLOK const U8 **ep|NULLOK STRLEN *el|const U32 flags
AmndP |bool |is_utf8_valid_partial_char \
|NN const U8 * const s|NN const U8 * const e
PERL_STATIC_INLINE bool
S_is_utf8_string_flags(const U8 *s, STRLEN len, const U32 flags)
{
- const U8* send;
- const U8* x = s;
+ const U8 * first_variant;
PERL_ARGS_ASSERT_IS_UTF8_STRING_FLAGS;
assert(0 == (flags & ~(UTF8_DISALLOW_ILLEGAL_INTERCHANGE
return is_c9strict_utf8_string(s, len);
}
- send = s + len;
+ if (! is_utf8_invariant_string_loc(s, len, &first_variant)) {
+ const U8* const send = s + len;
+ const U8* x = first_variant;
+
while (x < send) {
STRLEN cur_len = isUTF8_CHAR_flags(x, send, flags);
if (UNLIKELY(! cur_len)) {
}
x += cur_len;
}
+ }
return TRUE;
}
*/
PERL_STATIC_INLINE bool
-Perl_is_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el)
+Perl_is_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el)
{
- const U8* const send = s + (len ? len : strlen((const char *)s));
- const U8* x = s;
- STRLEN outlen = 0;
+ const U8 * first_variant;
PERL_ARGS_ASSERT_IS_UTF8_STRING_LOCLEN;
+ if (len == 0) {
+ len = strlen((const char *) s);
+ }
+
+ if (is_utf8_invariant_string_loc(s, len, &first_variant)) {
+ if (el)
+ *el = len;
+
+ if (ep) {
+ *ep = s + len;
+ }
+
+ return TRUE;
+ }
+
+ {
+ const U8* const send = s + len;
+ const U8* x = first_variant;
+ STRLEN outlen = first_variant - s;
+
while (x < send) {
const STRLEN cur_len = isUTF8_CHAR(x, send);
if (UNLIKELY(! cur_len)) {
}
return (x == send);
+ }
}
/*
*/
PERL_STATIC_INLINE bool
-S_is_strict_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el)
+S_is_strict_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el)
{
- const U8* const send = s + (len ? len : strlen((const char *)s));
- const U8* x = s;
- STRLEN outlen = 0;
+ const U8 * first_variant;
PERL_ARGS_ASSERT_IS_STRICT_UTF8_STRING_LOCLEN;
+ if (len == 0) {
+ len = strlen((const char *) s);
+ }
+
+ if (is_utf8_invariant_string_loc(s, len, &first_variant)) {
+ if (el)
+ *el = len;
+
+ if (ep) {
+ *ep = s + len;
+ }
+
+ return TRUE;
+ }
+
+ {
+ const U8* const send = s + len;
+ const U8* x = first_variant;
+ STRLEN outlen = first_variant - s;
+
while (x < send) {
const STRLEN cur_len = isSTRICT_UTF8_CHAR(x, send);
if (UNLIKELY(! cur_len)) {
}
return (x == send);
+ }
}
/*
*/
PERL_STATIC_INLINE bool
-S_is_c9strict_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el)
+S_is_c9strict_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el)
{
- const U8* const send = s + (len ? len : strlen((const char *)s));
- const U8* x = s;
- STRLEN outlen = 0;
+ const U8 * first_variant;
PERL_ARGS_ASSERT_IS_C9STRICT_UTF8_STRING_LOCLEN;
+ if (len == 0) {
+ len = strlen((const char *) s);
+ }
+
+ if (is_utf8_invariant_string_loc(s, len, &first_variant)) {
+ if (el)
+ *el = len;
+
+ if (ep) {
+ *ep = s + len;
+ }
+
+ return TRUE;
+ }
+
+ {
+ const U8* const send = s + len;
+ const U8* x = first_variant;
+ STRLEN outlen = first_variant - s;
+
while (x < send) {
const STRLEN cur_len = isC9_STRICT_UTF8_CHAR(x, send);
if (UNLIKELY(! cur_len)) {
}
return (x == send);
+ }
}
/*
PERL_STATIC_INLINE bool
S_is_utf8_string_loclen_flags(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el, const U32 flags)
{
- const U8* send;
- const U8* x = s;
- STRLEN outlen = 0;
+ const U8 * first_variant;
PERL_ARGS_ASSERT_IS_UTF8_STRING_LOCLEN_FLAGS;
assert(0 == (flags & ~(UTF8_DISALLOW_ILLEGAL_INTERCHANGE
return is_c9strict_utf8_string_loclen(s, len, ep, el);
}
- send = s + len;
+ if (is_utf8_invariant_string_loc(s, len, &first_variant)) {
+ if (el)
+ *el = len;
+
+ if (ep) {
+ *ep = s + len;
+ }
+
+ return TRUE;
+ }
+
+ {
+ const U8* send = s + len;
+ const U8* x = first_variant;
+ STRLEN outlen = first_variant - s;
+
while (x < send) {
const STRLEN cur_len = isUTF8_CHAR_flags(x, send, flags);
if (UNLIKELY(! cur_len)) {
}
return (x == send);
+ }
}
/*
PERL_STATIC_INLINE bool
S_is_utf8_fixed_width_buf_loclen_flags(const U8 * const s,
- const STRLEN len,
+ STRLEN len,
const U8 **ep,
STRLEN *el,
const U32 flags)
/* PERL_CALLCONV bool Perl_is_c9strict_utf8_string(const U8 *s, STRLEN len)
__attribute__warn_unused_result__; */
-/* PERL_CALLCONV bool is_c9strict_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep); */
+/* PERL_CALLCONV bool is_c9strict_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep); */
#ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool S_is_c9strict_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el);
+PERL_STATIC_INLINE bool S_is_c9strict_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el);
#define PERL_ARGS_ASSERT_IS_C9STRICT_UTF8_STRING_LOCLEN \
assert(s)
#endif
-/* PERL_CALLCONV bool Perl_is_invariant_string(const U8* const s, const STRLEN len)
+/* PERL_CALLCONV bool Perl_is_invariant_string(const U8* const s, STRLEN len)
__attribute__warn_unused_result__
__attribute__pure__; */
/* PERL_CALLCONV bool Perl_is_strict_utf8_string(const U8 *s, STRLEN len)
__attribute__warn_unused_result__; */
-/* PERL_CALLCONV bool is_strict_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep); */
+/* PERL_CALLCONV bool is_strict_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep); */
#ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool S_is_strict_utf8_string_loclen(const U8 *s, const STRLEN len, const U8 **ep, STRLEN *el);
+PERL_STATIC_INLINE bool S_is_strict_utf8_string_loclen(const U8 *s, STRLEN len, const U8 **ep, STRLEN *el);
#define PERL_ARGS_ASSERT_IS_STRICT_UTF8_STRING_LOCLEN \
assert(s)
#endif
#define PERL_ARGS_ASSERT_IS_UTF8_DIGIT \
assert(p)
-/* PERL_CALLCONV bool is_utf8_fixed_width_buf_flags(const U8 * const s, const STRLEN len, const U32 flags); */
-/* PERL_CALLCONV bool is_utf8_fixed_width_buf_loc_flags(const U8 * const s, const STRLEN len, const U8 **ep, const U32 flags); */
+/* PERL_CALLCONV bool is_utf8_fixed_width_buf_flags(const U8 * const s, STRLEN len, const U32 flags); */
+/* PERL_CALLCONV bool is_utf8_fixed_width_buf_loc_flags(const U8 * const s, STRLEN len, const U8 **ep, const U32 flags); */
#ifndef PERL_NO_INLINE_FUNCTIONS
-PERL_STATIC_INLINE bool S_is_utf8_fixed_width_buf_loclen_flags(const U8 * const s, const STRLEN len, const U8 **ep, STRLEN *el, const U32 flags);
+PERL_STATIC_INLINE bool S_is_utf8_fixed_width_buf_loclen_flags(const U8 * const s, STRLEN len, const U8 **ep, STRLEN *el, const U32 flags);
#define PERL_ARGS_ASSERT_IS_UTF8_FIXED_WIDTH_BUF_LOCLEN_FLAGS \
assert(s)
#endif
#endif
#ifndef NO_MATHOMS
-PERL_CALLCONV bool Perl_is_utf8_string_loc(const U8 *s, const STRLEN len, const U8 **ep);
+PERL_CALLCONV bool Perl_is_utf8_string_loc(const U8 *s, STRLEN len, const U8 **ep);
#define PERL_ARGS_ASSERT_IS_UTF8_STRING_LOC \
assert(s); assert(ep)
#endif