summaryrefslogtreecommitdiff
path: root/lib/uniname
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/uniname
parent27dae84ed92f1ef0300263091972338d12e78348 (diff)
New upstream version 1.4.2upstream/1.4.2upstream
Diffstat (limited to 'lib/uniname')
-rwxr-xr-xlib/uniname/gen-uninames.lisp2
-rw-r--r--lib/uniname/uniname.c57
2 files changed, 19 insertions, 40 deletions
diff --git a/lib/uniname/gen-uninames.lisp b/lib/uniname/gen-uninames.lisp
index dccc0f04..0925e97f 100755
--- a/lib/uniname/gen-uninames.lisp
+++ b/lib/uniname/gen-uninames.lisp
@@ -3,7 +3,7 @@
;;; Creation of gnulib's uninames.h from the UnicodeData.txt and NameAliases.txt
;;; tables.
-;;; Copyright (C) 2000-2025 Free Software Foundation, Inc.
+;;; Copyright (C) 2000-2026 Free Software Foundation, Inc.
;;; Written by Bruno Haible <bruno@clisp.org>, 2000-12-28.
;;;
;;; This program is free software.
diff --git a/lib/uniname/uniname.c b/lib/uniname/uniname.c
index 953b70df..074a8d85 100644
--- a/lib/uniname/uniname.c
+++ b/lib/uniname/uniname.c
@@ -1,5 +1,5 @@
/* Association between Unicode characters and their names.
- Copyright (C) 2000-2002, 2005-2007, 2009-2025 Free Software Foundation, Inc.
+ Copyright (C) 2000-2002, 2005-2007, 2009-2026 Free Software Foundation, Inc.
This file is free software.
It is dual-licensed under "the GNU LGPLv3+ or the GNU GPLv2+".
@@ -65,9 +65,6 @@
static const char *
unicode_name_word (unsigned int index, unsigned int *lengthp)
{
- unsigned int i1;
- unsigned int i2;
-
assert (index < UNICODE_CHARNAME_NUM_WORDS);
/* Binary search for i with
@@ -76,8 +73,8 @@ unicode_name_word (unsigned int index, unsigned int *lengthp)
index < unicode_name_by_length[i+1].ind_offset
*/
- i1 = 0;
- i2 = SIZEOF (unicode_name_by_length) - 1;
+ unsigned int i1 = 0;
+ unsigned int i2 = SIZEOF (unicode_name_by_length) - 1;
while (i2 - i1 > 1)
{
unsigned int i = (i1 + i2) >> 1;
@@ -238,22 +235,17 @@ unicode_character_name (ucs4_t c, char *buf)
if (c >= 0xAC00 && c <= 0xD7A3)
{
/* Special case for Hangul syllables. Keeps the tables small. */
- char *ptr;
- unsigned int tmp;
- unsigned int index1;
- unsigned int index2;
- unsigned int index3;
- const char *q;
/* buf needs to have at least 16 + 7 + 1 bytes here. */
memcpy (buf, "HANGUL SYLLABLE ", 16);
- ptr = buf + 16;
+ char *ptr = buf + 16;
- tmp = c - 0xAC00;
- index3 = tmp % 28; tmp = tmp / 28;
- index2 = tmp % 21; tmp = tmp / 21;
- index1 = tmp;
+ unsigned int tmp = c - 0xAC00;
+ unsigned int index3 = tmp % 28; tmp = tmp / 28;
+ unsigned int index2 = tmp % 21; tmp = tmp / 21;
+ unsigned int index1 = tmp;
+ const char *q;
q = jamo_initial_short_name[index1];
while (*q != '\0')
*ptr++ = *q++;
@@ -271,14 +263,12 @@ unicode_character_name (ucs4_t c, char *buf)
{
/* Special case for CJK compatibility ideographs. Keeps the tables
small. */
- char *ptr;
- int i;
/* buf needs to have at least 28 + 5 + 1 bytes here. */
memcpy (buf, "CJK COMPATIBILITY IDEOGRAPH-", 28);
- ptr = buf + 28;
+ char *ptr = buf + 28;
- for (i = (c < 0x10000 ? 12 : 16); i >= 0; i -= 4)
+ for (int i = (c < 0x10000 ? 12 : 16); i >= 0; i -= 4)
{
unsigned int x = (c >> i) & 0xf;
*ptr++ = (x < 10 ? '0' : 'A' - 10) + x;
@@ -424,11 +414,10 @@ unicode_name_character (const char *name)
for (;;)
{
{
- int word;
const char *p2 = p1;
while (p2 < ptr && *p2 != ' ')
p2++;
- word = unicode_name_word_lookup (p1, p2 - p1);
+ int word = unicode_name_word_lookup (p1, p2 - p1);
if (word < 0)
break;
if (wordptr == &words[UNICODE_CHARNAME_MAX_WORDS])
@@ -448,11 +437,7 @@ unicode_name_character (const char *name)
2) [AEIOUWY]
3) [BCDGHIJKLMNPST]
*/
- const char *p2;
- const char *p3;
- const char *p4;
-
- p2 = p1;
+ const char *p2 = p1;
while (p2 < ptr
&& (*p2 == 'B' || *p2 == 'C' || *p2 == 'D'
|| *p2 == 'G' || *p2 == 'H' || *p2 == 'J'
@@ -460,13 +445,13 @@ unicode_name_character (const char *name)
|| *p2 == 'P' || *p2 == 'R' || *p2 == 'S'
|| *p2 == 'T'))
p2++;
- p3 = p2;
+ const char *p3 = p2;
while (p3 < ptr
&& (*p3 == 'A' || *p3 == 'E' || *p3 == 'I'
|| *p3 == 'O' || *p3 == 'U' || *p3 == 'W'
|| *p3 == 'Y'))
p3++;
- p4 = p3;
+ const char *p4 = p3;
while (p4 < ptr
&& (*p4 == 'B' || *p4 == 'C' || *p4 == 'D'
|| *p4 == 'G' || *p4 == 'H' || *p4 == 'I'
@@ -482,21 +467,15 @@ unicode_name_character (const char *name)
if (n1 <= 2 && (n2 >= 1 && n2 <= 3) && n3 <= 2)
{
- unsigned int index1;
-
- for (index1 = 0; index1 < 19; index1++)
+ for (unsigned int index1 = 0; index1 < 19; index1++)
if (memeq (jamo_initial_short_name[index1], p1, n1)
&& jamo_initial_short_name[index1][n1] == '\0')
{
- unsigned int index2;
-
- for (index2 = 0; index2 < 21; index2++)
+ for (unsigned int index2 = 0; index2 < 21; index2++)
if (memeq (jamo_medial_short_name[index2], p2, n2)
&& jamo_medial_short_name[index2][n2] == '\0')
{
- unsigned int index3;
-
- for (index3 = 0; index3 < 28; index3++)
+ for (unsigned int index3 = 0; index3 < 28; index3++)
if (memeq (jamo_final_short_name[index3], p3, n3)
&& jamo_final_short_name[index3][n3] == '\0')
{