summaryrefslogtreecommitdiff
path: root/lib/uninorm/canonical-decomposition.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/uninorm/canonical-decomposition.c')
-rw-r--r--lib/uninorm/canonical-decomposition.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/lib/uninorm/canonical-decomposition.c b/lib/uninorm/canonical-decomposition.c
index 628d2f12..93169bf2 100644
--- a/lib/uninorm/canonical-decomposition.c
+++ b/lib/uninorm/canonical-decomposition.c
@@ -1,5 +1,5 @@
/* Canonical decomposition of Unicode characters.
- Copyright (C) 2009-2025 Free Software Foundation, Inc.
+ Copyright (C) 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This file is free software: you can redistribute it and/or modify
@@ -33,18 +33,14 @@ uc_canonical_decomposition (ucs4_t uc, ucs4_t *decomposition)
"Hangul Syllable Decomposition", See also the clarification at
<https://www.unicode.org/versions/Unicode5.1.0/>, section
"Clarification of Hangul Jamo Handling". */
- unsigned int t;
-
uc -= 0xAC00;
- t = uc % 28;
+ unsigned int t = uc % 28;
if (t == 0)
{
- unsigned int v, l;
-
uc = uc / 28;
- v = uc % 21;
- l = uc / 21;
+ unsigned int v = uc % 21;
+ unsigned int l = uc / 21;
decomposition[0] = 0x1100 + l;
decomposition[1] = 0x1161 + v;
@@ -57,11 +53,9 @@ uc_canonical_decomposition (ucs4_t uc, ucs4_t *decomposition)
decomposition[1] = 0x11A7 + t;
return 2;
#else
- unsigned int v, l;
-
uc = uc / 28;
- v = uc % 21;
- l = uc / 21;
+ unsigned int v = uc % 21;
+ unsigned int l = uc / 21;
decomposition[0] = 0x1100 + l;
decomposition[1] = 0x1161 + v;
@@ -78,16 +72,12 @@ uc_canonical_decomposition (ucs4_t uc, ucs4_t *decomposition)
is a canonical one. */
if (entry < 0x8000)
{
- const unsigned char *p;
- unsigned int element;
- unsigned int length;
-
- p = &gl_uninorm_decomp_chars_table[3 * entry];
- element = (p[0] << 16) | (p[1] << 8) | p[2];
+ const unsigned char *p = &gl_uninorm_decomp_chars_table[3 * entry];
+ unsigned int element = (p[0] << 16) | (p[1] << 8) | p[2];
/* The first element has 5 bits for the decomposition type. */
if (((element >> 18) & 0x1f) != UC_DECOMP_CANONICAL)
abort ();
- length = 1;
+ unsigned int length = 1;
for (;;)
{
/* Every element has an 18 bits wide Unicode code point. */