summaryrefslogtreecommitdiff
path: root/lib/uniconv/u8-strconv-to-enc.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2026-03-08 17:28:33 +0100
committerJörg Frings-Fürst <debian@jff.email>2026-03-08 17:28:33 +0100
commit5f59a34ab747dde8ede7357f3431bf06bd6002fe (patch)
tree056a4477fd870d454d5be5868cddab829a47f4d2 /lib/uniconv/u8-strconv-to-enc.c
parent27dae84ed92f1ef0300263091972338d12e78348 (diff)
New upstream version 1.4.2upstream/1.4.2upstream
Diffstat (limited to 'lib/uniconv/u8-strconv-to-enc.c')
-rw-r--r--lib/uniconv/u8-strconv-to-enc.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/uniconv/u8-strconv-to-enc.c b/lib/uniconv/u8-strconv-to-enc.c
index d346c482..35bd5813 100644
--- a/lib/uniconv/u8-strconv-to-enc.c
+++ b/lib/uniconv/u8-strconv-to-enc.c
@@ -1,5 +1,5 @@
/* Conversion from UTF-8 to legacy encodings.
- Copyright (C) 2002, 2006-2007, 2009-2025 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
This file is free software.
It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
@@ -42,19 +42,16 @@ u8_strconv_to_encoding (const uint8_t *string,
const char *tocode,
enum iconv_ilseq_handler handler)
{
- char *result;
- size_t length;
-
if (STRCASEEQ (tocode, "UTF-8", 'U','T','F','-','8',0,0,0,0))
{
/* Conversion from UTF-8 to UTF-8. No need to go through iconv(). */
- length = u8_strlen (string) + 1;
+ size_t length = u8_strlen (string) + 1;
if (u8_check (string, length))
{
errno = EILSEQ;
return NULL;
}
- result = (char *) malloc (length);
+ char *result = (char *) malloc (length);
if (result == NULL)
{
errno = ENOMEM;
@@ -65,8 +62,8 @@ u8_strconv_to_encoding (const uint8_t *string,
}
else
{
- result = NULL;
- length = 0;
+ char *result = NULL;
+ size_t length = 0;
if (mem_iconveha ((const char *) string, u8_strlen (string) + 1,
"UTF-8", tocode,
handler == iconveh_question_mark, handler,