Skip to content

Commit 3151c32

Browse files
committed
utf8n_to_uvchr_msgs: Move declarations closer to use
1 parent ef862b5 commit 3151c32

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

inline.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,18 +2983,14 @@ Perl_utf8n_to_uvchr_msgs(const U8 *s,
29832983
U32 * errors,
29842984
AV ** msgs)
29852985
{
2986+
PERL_ARGS_ASSERT_UTF8N_TO_UVCHR_MSGS;
2987+
29862988
/* This is the inlined portion of utf8n_to_uvchr_msgs. It handles the
29872989
* simple cases, and, if necessary calls a helper function to deal with the
29882990
* more complex ones. Almost all well-formed non-problematic code points
29892991
* are considered simple, so that it's unlikely that the helper function
29902992
* will need to be called. */
29912993

2992-
const U8 * const s0 = s;
2993-
const U8 * send = s0 + curlen;
2994-
UV uv;
2995-
2996-
PERL_ARGS_ASSERT_UTF8N_TO_UVCHR_MSGS;
2997-
29982994
/* Assume that isn't malformed; the vast majority of calls won't be */
29992995
if (errors) {
30002996
*errors = 0;
@@ -3003,6 +2999,7 @@ Perl_utf8n_to_uvchr_msgs(const U8 *s,
30032999
*msgs = NULL;
30043000
}
30053001

3002+
const U8 * s0;
30063003

30073004
/* No calls from core pass in an empty string; non-core need a check */
30083005
#ifdef PERL_CORE
@@ -3023,6 +3020,9 @@ Perl_utf8n_to_uvchr_msgs(const U8 *s,
30233020
return *s;
30243021
}
30253022

3023+
const U8 * send = s + curlen;
3024+
s0 = s;
3025+
30263026
/* This dfa is fast. If it accepts the input, it was for a
30273027
* well-formed, non-problematic code point, which can be returned
30283028
* immediately. Otherwise we call a helper function to figure out the
@@ -3040,7 +3040,7 @@ Perl_utf8n_to_uvchr_msgs(const U8 *s,
30403040
* */
30413041
PERL_UINT_FAST8_T type = PL_strict_utf8_dfa_tab[*s];
30423042
PERL_UINT_FAST8_T state = PL_strict_utf8_dfa_tab[256 + type];
3043-
uv = (0xff >> type) & NATIVE_UTF8_TO_I8(*s);
3043+
UV uv = (0xff >> type) & NATIVE_UTF8_TO_I8(*s);
30443044

30453045
while (state > 1 && ++s < send) {
30463046
type = PL_strict_utf8_dfa_tab[*s];

0 commit comments

Comments
 (0)