Skip to content

Commit 6b30aa3

Browse files
committed
utf8_to_uv_msgs: Use already computed value
Instead of doing the subtraction again, use the variable that already contains the desired value.
1 parent 5104b9a commit 6b30aa3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

utf8.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,7 +2280,7 @@ Perl_utf8_to_uv_msgs_helper_(const U8 * const s0,
22802280
message = Perl_form(aTHX_
22812281
"%s: %s (too short; %d byte%s available, need %d)",
22822282
malformed_text,
2283-
_byte_dump_string(s0, send - s0, 0),
2283+
_byte_dump_string(s0, avail_len, 0),
22842284
(int)avail_len,
22852285
avail_len == 1 ? "" : "s", /* Pluralize */
22862286
(int)expectlen);
@@ -2294,7 +2294,7 @@ Perl_utf8_to_uv_msgs_helper_(const U8 * const s0,
22942294
* end of the buffer */
22952295
int printlen = (flags & UTF8_NO_CONFIDENCE_IN_CURLEN_)
22962296
? (int) (s - s0)
2297-
: (int) (send - s0);
2297+
: (int) (avail_len);
22982298
message = Perl_form(aTHX_ "%s",
22992299
unexpected_non_continuation_text(s0,
23002300
printlen,
@@ -2341,7 +2341,7 @@ Perl_utf8_to_uv_msgs_helper_(const U8 * const s0,
23412341
"%s: %s (overlong; instead use %s to represent"
23422342
" %s%0*" UVXf ")",
23432343
malformed_text,
2344-
_byte_dump_string(s0, send - s0, 0),
2344+
_byte_dump_string(s0, avail_len, 0),
23452345
_byte_dump_string(tmpbuf, e - tmpbuf, 0),
23462346
preface,
23472347
((input_uv < 256) ? 2 : 4), /* Field width of 2

0 commit comments

Comments
 (0)