From: kosako Date: Wed, 6 Apr 2016 00:27:18 +0000 (+0900) Subject: add ERROR ONIGERR_LIBRARY_IS_NOT_INITIALIZED X-Git-Tag: v6.0.0^2~70 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=38e222d7cd528f4a294a51217bc91895b181a4a9;p=onig add ERROR ONIGERR_LIBRARY_IS_NOT_INITIALIZED --- diff --git a/src/oniguruma.h b/src/oniguruma.h index 5555400..33e8056 100644 --- a/src/oniguruma.h +++ b/src/oniguruma.h @@ -588,6 +588,7 @@ ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax; #define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE -401 #define ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION -402 #define ONIGERR_INVALID_COMBINATION_OF_OPTIONS -403 +#define ONIGERR_LIBRARY_IS_NOT_INITIALIZED -500 /* errors related to thread */ /* #define ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT -1001 */ diff --git a/src/regcomp.c b/src/regcomp.c index a398e65..ed31eea 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -5416,6 +5416,9 @@ onig_reg_init(regex_t* reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, OnigSyntaxType* syntax) { + if (onig_inited == 0) + return ONIGERR_LIBRARY_IS_NOT_INITIALIZED; + if (IS_NULL(reg)) return ONIGERR_INVALID_ARGUMENT; diff --git a/src/regerror.c b/src/regerror.c index 9b6a9e1..94a163e 100644 --- a/src/regerror.c +++ b/src/regerror.c @@ -172,6 +172,8 @@ onig_error_code_to_format(int code) p = "not supported encoding combination"; break; case ONIGERR_INVALID_COMBINATION_OF_OPTIONS: p = "invalid combination of options"; break; + case ONIGERR_LIBRARY_IS_NOT_INITIALIZED: + p = "library is not initialized"; break; default: p = "undefined error code"; break; diff --git a/src/regposix.c b/src/regposix.c index 9d68dcd..e750614 100644 --- a/src/regposix.c +++ b/src/regposix.c @@ -113,8 +113,8 @@ onig2posix_error_code(int code) { ONIGERR_NEVER_ENDING_RECURSION, REG_BADPAT }, { ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY, REG_BADPAT }, { ONIGERR_INVALID_CHAR_PROPERTY_NAME, REG_BADPAT }, - { ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION, REG_EONIG_BADARG } - + { ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION, REG_EONIG_BADARG }, + { ONIGERR_LIBRARY_IS_NOT_INITIALIZED, REG_EONIG_INTERNAL } }; int i;