diff options
| author | Mattias Andrée <m@maandree.se> | 2026-01-28 22:03:48 +0100 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-01-28 22:03:48 +0100 |
| commit | 40bf70fb8f23e5ff7212b568c69e0725372e5b57 (patch) | |
| tree | 0d4be706d0182ddeafd4eaafd073e12c2fa2a9e8 /libcharconv_script.c | |
| parent | Misc stuff (diff) | |
| download | charconv-40bf70fb8f23e5ff7212b568c69e0725372e5b57.tar.gz charconv-40bf70fb8f23e5ff7212b568c69e0725372e5b57.tar.bz2 charconv-40bf70fb8f23e5ff7212b568c69e0725372e5b57.tar.xz | |
Clean up
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'libcharconv_script.c')
| -rw-r--r-- | libcharconv_script.c | 57 |
1 files changed, 14 insertions, 43 deletions
diff --git a/libcharconv_script.c b/libcharconv_script.c index 2617c58..5149aad 100644 --- a/libcharconv_script.c +++ b/libcharconv_script.c @@ -7,49 +7,20 @@ libcharconv_script(const char *s, size_t slen, size_t *n, uint_least32_t *cp, si { uint_least32_t c; *n = 0; - for (; slen--; s++) { - if (*s == 'B') { - c = (uint_least32_t)UINT32_C(0x212C); - goto conv; - } else if (*s == 'E') { - c = (uint_least32_t)UINT32_C(0x2130); - goto conv; - } else if (*s == 'F') { - c = (uint_least32_t)UINT32_C(0x2131); - goto conv; - } else if (*s == 'H') { - c = (uint_least32_t)UINT32_C(0x210B); - goto conv; - } else if (*s == 'I') { - c = (uint_least32_t)UINT32_C(0x2110); - goto conv; - } else if (*s == 'L') { - c = (uint_least32_t)UINT32_C(0x2112); - goto conv; - } else if (*s == 'M') { - c = (uint_least32_t)UINT32_C(0x2133); - goto conv; - } else if (*s == 'R') { - c = (uint_least32_t)UINT32_C(0x211B); - goto conv; - } else if (*s == 'e') { - c = (uint_least32_t)UINT32_C(0x212F); - goto conv; - } else if (*s == 'g') { - c = (uint_least32_t)UINT32_C(0x210A); - goto conv; - } else if (*s == 'o') { - c = (uint_least32_t)UINT32_C(0x2134); - goto conv; - } else if ('A' <= *s && *s <= 'Z') { - c = (uint_least32_t)(UINT32_C(0x1D49C) + (unsigned)(*s - 'A')); - goto conv; - } else if ('a' <= *s && *s <= 'z') { - c = (uint_least32_t)(UINT32_C(0x1D4B6) + (unsigned)(*s - 'a')); - goto conv; - } else { - *n += 1u; - } + for (; slen--; s++, ++*n) { + PLAIN_SINGLE('B', 0x212C); + PLAIN_SINGLE('E', 0x2130); + PLAIN_SINGLE('F', 0x2131); + PLAIN_SINGLE('H', 0x210B); + PLAIN_SINGLE('I', 0x2110); + PLAIN_SINGLE('L', 0x2112); + PLAIN_SINGLE('M', 0x2133); + PLAIN_SINGLE('R', 0x211B); + PLAIN_SINGLE('e', 0x212F); + PLAIN_SINGLE('g', 0x210A); + PLAIN_SINGLE('o', 0x2134); + PLAIN_RANGE('A', 'Z', 0x1D49C); + PLAIN_RANGE('a', 'z', 0x1D4B6); } no_conv: return LIBCHARCONV_NO_CONVERT; |
