From bf8d2d296132a46ce7f945ca408811e8e9fe7d6d Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Fri, 15 Sep 2017 18:38:36 +0900 Subject: [PATCH] change gperf wordlist type from int to short int --- src/gperf_fold_key_conv.py | 2 +- src/make_unicode_fold_data.py | 6 +++--- src/unicode_fold1_key.c | 2 +- src/unicode_fold2_key.c | 2 +- src/unicode_fold3_key.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gperf_fold_key_conv.py b/src/gperf_fold_key_conv.py index 5267aa4..59c5de9 100755 --- a/src/gperf_fold_key_conv.py +++ b/src/gperf_fold_key_conv.py @@ -9,7 +9,7 @@ import re REG_LINE_GPERF = re.compile('#line .+gperf"') REG_HASH_FUNC = re.compile('hash\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+unsigned\s+int\s+len\s*\)') REG_STR_AT = re.compile('str\[(\d+)\]') -REG_RETURN_TYPE = re.compile('^const\s+int\s*\*') +REG_RETURN_TYPE = re.compile('^const\s+short\s+int\s*\*') REG_FOLD_KEY = re.compile('unicode_fold(\d)_key\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+unsigned\s+int\s+len\)') REG_ENTRY = re.compile('\{".*?",\s*(-?\d+)\s*\}') REG_IF_LEN = re.compile('if\s*\(\s*len\s*<=\s*MAX_WORD_LENGTH.+') diff --git a/src/make_unicode_fold_data.py b/src/make_unicode_fold_data.py index f4ad321..64aa3a2 100755 --- a/src/make_unicode_fold_data.py +++ b/src/make_unicode_fold_data.py @@ -250,8 +250,8 @@ def output_gperf_unfold_key(f): %} struct ByUnfoldKey { OnigCodePoint code; - int index; - int fold_len; + short int index; + short int fold_len; }; %% """ @@ -272,7 +272,7 @@ def output_gperf_fold_key(f, key_len): #include #include "regenc.h" %} -int +short int %% """ f.write(head) diff --git a/src/unicode_fold1_key.c b/src/unicode_fold1_key.c index 2151211..ffaa661 100644 --- a/src/unicode_fold1_key.c +++ b/src/unicode_fold1_key.c @@ -69,7 +69,7 @@ __attribute__ ((__gnu_inline__)) int unicode_fold1_key(OnigCodePoint codes[]) { - static const int wordlist[] = + static const short int wordlist[] = { -1, -1, -1, -1, -1, -1, diff --git a/src/unicode_fold2_key.c b/src/unicode_fold2_key.c index 07cfa4e..8a45c9d 100644 --- a/src/unicode_fold2_key.c +++ b/src/unicode_fold2_key.c @@ -69,7 +69,7 @@ __attribute__ ((__gnu_inline__)) int unicode_fold2_key(OnigCodePoint codes[]) { - static const int wordlist[] = + static const short int wordlist[] = { 101, diff --git a/src/unicode_fold3_key.c b/src/unicode_fold3_key.c index 1b4d9d4..deb9d22 100644 --- a/src/unicode_fold3_key.c +++ b/src/unicode_fold3_key.c @@ -69,7 +69,7 @@ __attribute__ ((__gnu_inline__)) int unicode_fold3_key(OnigCodePoint codes[]) { - static const int wordlist[] = + static const short int wordlist[] = { 62, -- 2.40.0