Skip to content

Commit 37abfd5

Browse files
committed
utf8.c: Create a #define
This creates a #define of the string in a string array constant. The constant was to avoid having this common string appear in multiple places, but there is a benefit to having it in one place separately, which this commit also does. And that is, it makes a call to Perl_form() consistent with two other calls that the next commit will combine.
1 parent 25edbe8 commit 37abfd5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

utf8.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
#include "perl.h"
3535
#include "invlist_inline.h"
3636

37-
static const char malformed_text[] = "Malformed UTF-8 character";
37+
#define MALFORMED_TEXT "Malformed UTF-8 character"
38+
static const char malformed_text[] = MALFORMED_TEXT;
3839
static const char unees[] =
3940
"Malformed UTF-8 character (unexpected end of string)";
4041

@@ -2282,8 +2283,8 @@ Perl_utf8_to_uv_msgs_helper_(const U8 * const s0,
22822283
pack_warn = NEED_MESSAGE(WARN_UTF8,
22832284
ckWARN_d, WARN_NON_UNICODE);
22842285
if (pack_warn) {
2285-
message = Perl_form(aTHX_ "%s: %s (overflows)",
2286-
malformed_text,
2286+
message = Perl_form(aTHX_ MALFORMED_TEXT
2287+
": %s (overflows)",
22872288
_byte_dump_string(s0, curlen, 0));
22882289
}
22892290
}

0 commit comments

Comments
 (0)