diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:33 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:33 +0100 |
| commit | 5f59a34ab747dde8ede7357f3431bf06bd6002fe (patch) | |
| tree | 056a4477fd870d454d5be5868cddab829a47f4d2 /lib/unistr/u16-chr.c | |
| parent | 27dae84ed92f1ef0300263091972338d12e78348 (diff) | |
New upstream version 1.4.2upstream/1.4.2upstream
Diffstat (limited to 'lib/unistr/u16-chr.c')
| -rw-r--r-- | lib/unistr/u16-chr.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/lib/unistr/u16-chr.c b/lib/unistr/u16-chr.c index 6c7999ad..75d75dfc 100644 --- a/lib/unistr/u16-chr.c +++ b/lib/unistr/u16-chr.c @@ -1,5 +1,5 @@ /* Search character in piece of UTF-16 string. - Copyright (C) 1999, 2002, 2006-2007, 2009-2025 Free Software Foundation, + Copyright (C) 1999, 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2002. @@ -35,8 +35,6 @@ uint16_t * u16_chr (const uint16_t *s, size_t n, ucs4_t uc) { - uint16_t c[2]; - if (uc < 0x10000) { uint16_t c0 = uc; @@ -48,21 +46,25 @@ u16_chr (const uint16_t *s, size_t n, ucs4_t uc) } } else - switch (u16_uctomb_aux (c, uc, 2)) - { - case 2: - if (n > 1) - { - uint16_t c0 = c[0]; - uint16_t c1 = c[1]; + { + uint16_t c[2]; + + switch (u16_uctomb_aux (c, uc, 2)) + { + case 2: + if (n > 1) + { + uint16_t c0 = c[0]; + uint16_t c1 = c[1]; - for (n--; n > 0; s++, n--) - { - if (*s == c0 && s[1] == c1) - return (uint16_t *) s; - } - } - break; - } + for (n--; n > 0; s++, n--) + { + if (*s == c0 && s[1] == c1) + return (uint16_t *) s; + } + } + break; + } + } return NULL; } |
