From 78c355902e1a0b5d00b00232dc303775b06c6483 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Thu, 28 Oct 2010 14:55:51 +0100 Subject: In S_scan_const(), use the return value of my_sprintf() to avoid a strlen(). Brought to you by the campaign for the elimination of strlen(). --- toke.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'toke.c') diff --git a/toke.c b/toke.c index a30f60b6d5..64be92293d 100644 --- a/toke.c +++ b/toke.c @@ -3199,8 +3199,8 @@ S_scan_const(pTHX_ char *start) /* Convert first code point to hex, including the * boiler plate before it */ - sprintf(hex_string, "\\N{U+%X", (unsigned int) uv); - output_length = strlen(hex_string); + output_length = + my_sprintf(hex_string, "\\N{U+%X", (unsigned int) uv); /* Make sure there is enough space to hold it */ d = off + SvGROW(sv, off @@ -3223,8 +3223,8 @@ S_scan_const(pTHX_ char *start) uv = UNICODE_REPLACEMENT; } - sprintf(hex_string, ".%X", (unsigned int) uv); - output_length = strlen(hex_string); + output_length = + my_sprintf(hex_string, ".%X", (unsigned int) uv); d = off + SvGROW(sv, off + output_length -- cgit v1.2.1