From 26436c9775e36ec9f608574b87626de139b345ba Mon Sep 17 00:00:00 2001 From: Michaƫl Meyer Date: Wed, 9 Dec 2015 19:55:48 +0100 Subject: Reduce the size of the binary. Use integers instead of pointers in Unicode tables. Saves 226 kb / 716 kb in the compiled library. --- utf8proc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'utf8proc.c') diff --git a/utf8proc.c b/utf8proc.c index 1f17730..ab23a87 100644 --- a/utf8proc.c +++ b/utf8proc.c @@ -357,10 +357,10 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_char(utf8proc_int32_t uc, category == UTF8PROC_CATEGORY_ME) return 0; } if (options & UTF8PROC_CASEFOLD) { - if (property->casefold_mapping) { + if (property->casefold_mapping != UINT16_MAX) { const utf8proc_int32_t *casefold_entry; utf8proc_ssize_t written = 0; - for (casefold_entry = property->casefold_mapping; + for (casefold_entry = &utf8proc_sequences[property->casefold_mapping]; *casefold_entry >= 0; casefold_entry++) { written += utf8proc_decompose_char(*casefold_entry, dst+written, (bufsize > written) ? (bufsize - written) : 0, options, @@ -371,11 +371,11 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_char(utf8proc_int32_t uc, } } if (options & (UTF8PROC_COMPOSE|UTF8PROC_DECOMPOSE)) { - if (property->decomp_mapping && + if (property->decomp_mapping != UINT16_MAX && (!property->decomp_type || (options & UTF8PROC_COMPAT))) { const utf8proc_int32_t *decomp_entry; utf8proc_ssize_t written = 0; - for (decomp_entry = property->decomp_mapping; + for (decomp_entry = &utf8proc_sequences[property->decomp_mapping]; *decomp_entry >= 0; decomp_entry++) { written += utf8proc_decompose_char(*decomp_entry, dst+written, (bufsize > written) ? (bufsize - written) : 0, options, -- cgit v1.2.3