From 6548d176a4dc0362dcd520b2e40da47b5d06b7bc Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Fri, 2 Mar 2018 17:38:13 +0900 Subject: [PATCH] remove is_initialized() member from some encodings --- src/ascii.c | 14 ++++++-------- src/utf16_be.c | 15 +-------------- src/utf16_le.c | 17 +---------------- 3 files changed, 8 insertions(+), 38 deletions(-) diff --git a/src/ascii.c b/src/ascii.c index 750e78c..cf4d484 100644 --- a/src/ascii.c +++ b/src/ascii.c @@ -29,12 +29,9 @@ #include "regint.h" /* for USE_CALLOUT */ -static int inited; - static int init(void) { - if (inited == 0) { #ifdef USE_CALLOUT int id; @@ -63,17 +60,18 @@ init(void) #endif /* USE_CALLOUT */ - inited = 1; - } - return ONIG_NORMAL; } +#if 0 static int is_initialized(void) { - return inited; + /* Don't use this function */ + /* can't answer, because builtin callout entries removed in onig_end() */ + return 0; } +#endif static int ascii_is_code_ctype(OnigCodePoint code, unsigned int ctype) @@ -102,6 +100,6 @@ OnigEncodingType OnigEncodingASCII = { onigenc_single_byte_left_adjust_char_head, onigenc_always_true_is_allowed_reverse_match, init, - is_initialized, + 0, /* is_initialized */ onigenc_always_true_is_valid_mbc_string }; diff --git a/src/utf16_be.c b/src/utf16_be.c index 865a4a0..c6820e4 100644 --- a/src/utf16_be.c +++ b/src/utf16_be.c @@ -30,12 +30,9 @@ #include "regint.h" /* for USE_CALLOUT */ -static int inited; - static int init(void) { - if (inited == 0) { #ifdef USE_CALLOUT int id; @@ -65,19 +62,9 @@ init(void) #endif /* USE_CALLOUT */ - inited = 1; - } - return ONIG_NORMAL; } -static int -is_initialized(void) -{ - return inited; -} - - static const int EncLen_UTF16[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -279,6 +266,6 @@ OnigEncodingType OnigEncodingUTF16_BE = { utf16be_left_adjust_char_head, onigenc_always_false_is_allowed_reverse_match, init, - is_initialized, + 0, /* is_initialized */ is_valid_mbc_string }; diff --git a/src/utf16_le.c b/src/utf16_le.c index 15c6528..d2cdd9e 100644 --- a/src/utf16_le.c +++ b/src/utf16_le.c @@ -26,16 +26,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ - #include "regint.h" /* for USE_CALLOUT */ - -static int inited; - static int init(void) { - if (inited == 0) { #ifdef USE_CALLOUT int id; @@ -65,19 +60,9 @@ init(void) #endif /* USE_CALLOUT */ - inited = 1; - } - return ONIG_NORMAL; } -static int -is_initialized(void) -{ - return inited; -} - - static const int EncLen_UTF16[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -289,6 +274,6 @@ OnigEncodingType OnigEncodingUTF16_LE = { utf16le_left_adjust_char_head, onigenc_always_false_is_allowed_reverse_match, init, - is_initialized, + 0, /* is_initialized */ is_valid_mbc_string }; -- 2.40.0