From 535db98daf235bc8f9ccb911a08c9847c0b04811 Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Thu, 25 Jan 2018 11:29:55 +0900 Subject: [PATCH] implement onig_set/get_try_in_match_limit() in disabled USE_TRY_IN_MATCH_LIMIT case --- src/regexec.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/regexec.c b/src/regexec.c index 560f0cb..d964bbc 100644 --- a/src/regexec.c +++ b/src/regexec.c @@ -952,28 +952,37 @@ onig_set_match_stack_limit_size(unsigned int size) static unsigned long TryInMatchLimit = DEFAULT_TRY_IN_MATCH_LIMIT; +#define CHECK_TRY_IN_MATCH_LIMIT do {\ + if (try_in_match_counter++ > TryInMatchLimit) goto try_in_match_limit_over;\ +} while (0) + +#else + +#define CHECK_TRY_IN_MATCH_LIMIT + +#endif /* USE_TRY_IN_MATCH_LIMIT */ + extern unsigned long onig_get_try_in_match_limit(void) { +#ifdef USE_TRY_IN_MATCH_LIMIT return TryInMatchLimit; +#else + //return ONIG_NO_SUPPORT_CONFIG; + return 0; +#endif } extern int onig_set_try_in_match_limit(unsigned long size) { +#ifdef USE_TRY_IN_MATCH_LIMIT TryInMatchLimit = size; return 0; -} - -#define CHECK_TRY_IN_MATCH_LIMIT do {\ - if (try_in_match_counter++ > TryInMatchLimit) goto try_in_match_limit_over;\ -} while (0) - #else - -#define CHECK_TRY_IN_MATCH_LIMIT - -#endif /* USE_TRY_IN_MATCH_LIMIT */ + return ONIG_NO_SUPPORT_CONFIG; +#endif +} static int -- 2.40.0