From: K.Kosako Date: Thu, 22 Feb 2018 04:57:46 +0000 (+0900) Subject: remove dirs code from OP_CALLOUT_CODE/NAME X-Git-Tag: v6.8.0~223 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61ca9c780460e7ade3eff44a1eb2c1a37cd78e32;p=onig remove dirs code from OP_CALLOUT_CODE/NAME --- diff --git a/src/regcomp.c b/src/regcomp.c index dd7e73f..41d9a15 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -1551,8 +1551,6 @@ compile_gimmick_node(GimmickNode* node, regex_t* reg) } r = add_mem_num(reg, node->num); if (r != 0) return r; - r = add_mem_num(reg, node->dirs); - if (r != 0) return r; } break; diff --git a/src/regexec.c b/src/regexec.c index 5626bb4..246a06e 100644 --- a/src/regexec.c +++ b/src/regexec.c @@ -533,25 +533,19 @@ onig_print_compiled_byte_code(FILE* f, UChar* bp, UChar** nextp, UChar* start, #ifdef USE_CALLOUT case OP_CALLOUT_CODE: { - int dirs; - GET_MEMNUM_INC(mem, bp); // number - GET_MEMNUM_INC(dirs, bp); - - fprintf(f, ":%d:%d", mem, dirs); + fprintf(f, ":%d", mem); } break; case OP_CALLOUT_NAME: { - int dirs; int id; GET_MEMNUM_INC(id, bp); // id GET_MEMNUM_INC(mem, bp); // number - GET_MEMNUM_INC(dirs, bp); - fprintf(f, ":%d:%d:%d:%p:%p", id, mem, dirs); + fprintf(f, ":%d:%d", id, mem); } break; #endif @@ -3664,7 +3658,8 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, { int call_result; int num; - int dirs; + int in; + CalloutListEntry* e; OnigCalloutArgs args; of = ONIG_CALLOUT_OF_NAME; @@ -3672,10 +3667,12 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, func = onig_get_callout_start_func_from_name_id(name_id); callout_common_entry: - GET_MEMNUM_INC(num, p); - GET_MEMNUM_INC(dirs, p); + GET_MEMNUM_INC(num, p); + + e = onig_reg_callout_list_at(reg, num); + in = e->in; - if (IS_NOT_NULL(func) && (dirs & ONIG_CALLOUT_IN_PROGRESS) != 0) { + if (IS_NOT_NULL(func) && (in & ONIG_CALLOUT_IN_PROGRESS) != 0) { CALLOUT_BODY(func, ONIG_CALLOUT_IN_PROGRESS, of, name_id, num, msa->mp->callout_user_data, args, call_result); switch (call_result) { @@ -3698,7 +3695,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, } else { retraction_callout2: - if ((dirs & ONIG_CALLOUT_IN_RETRACTION) != 0) { + if ((in & ONIG_CALLOUT_IN_RETRACTION) != 0) { if (of == ONIG_CALLOUT_OF_NAME) { func = onig_get_callout_start_func_from_name_id(name_id); if (IS_NOT_NULL(func)) { @@ -5019,6 +5016,9 @@ onig_get_used_stack_size_in_callout(OnigCalloutArgs* a, int* used_num, int* used return ONIG_NORMAL; } + +/* builtin callout functions */ + extern int onig_builtin_fail(OnigCalloutArgs* args ARG_UNUSED, void* user_data ARG_UNUSED) { diff --git a/src/regint.h b/src/regint.h index fb8ec4d..97773a3 100644 --- a/src/regint.h +++ b/src/regint.h @@ -745,8 +745,8 @@ typedef int ModeType; #define SIZE_OP_UPDATE_VAR (SIZE_OPCODE + SIZE_UPDATE_VAR_TYPE + SIZE_MEMNUM) #ifdef USE_CALLOUT -#define SIZE_OP_CALLOUT_CODE (SIZE_OPCODE + SIZE_MEMNUM + SIZE_MEMNUM) -#define SIZE_OP_CALLOUT_NAME (SIZE_OPCODE + SIZE_MEMNUM + SIZE_MEMNUM + SIZE_MEMNUM) +#define SIZE_OP_CALLOUT_CODE (SIZE_OPCODE + SIZE_MEMNUM) +#define SIZE_OP_CALLOUT_NAME (SIZE_OPCODE + SIZE_MEMNUM + SIZE_MEMNUM) #endif #define MC_ESC(syn) (syn)->meta_char_table.esc