]> granicus.if.org Git - onig/commitdiff
remove dirs code from OP_CALLOUT_CODE/NAME
authorK.Kosako <kosako@sofnec.co.jp>
Thu, 22 Feb 2018 04:57:46 +0000 (13:57 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Thu, 22 Feb 2018 04:57:46 +0000 (13:57 +0900)
src/regcomp.c
src/regexec.c
src/regint.h

index dd7e73f69d88d10402cb8845a44ede0a15b1e38e..41d9a15abcf25cd86960534b3cf1f132d25126ae 100644 (file)
@@ -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;
 
index 5626bb49b157547629373548f78a0046ae9c919f..246a06edd581f1d785381df922235a407478e1b0 100644 (file)
@@ -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)
 {
index fb8ec4d8b06bf8af251649cacd15b030e65b101d..97773a3b04688b68b485fda0d825679973d10409 100644 (file)
@@ -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