From b6a32fbd5f575b2eedcce560ee1a0a0d458fba75 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 7 Apr 2021 16:02:25 +0200 Subject: [PATCH] tweaks: elide an unneeded resetting NULL call to wctomb() Calling wctomb() with NULL as the first parameter returns zero in a UTF-8 locale, meaning that there is no state, so there is no point in resetting it either. --- src/chars.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/chars.c b/src/chars.c index b3eeb1b5..b6f6586a 100644 --- a/src/chars.c +++ b/src/chars.c @@ -261,10 +261,8 @@ char *make_mbchar(long code, int *length) *length = wctomb(mb_char, (wchar_t)code); - if (*length < 0) { - IGNORE_CALL_RESULT(wctomb(NULL, 0)); + if (*length < 0) *length = 0; - } return mb_char; }