From 4ff819479b317a1e20c3488ca7eaf1eae5e9bfb0 Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Thu, 21 Jun 2018 17:18:30 +0900 Subject: [PATCH] remove IS_DYNAMIC_OPTION() --- src/regcomp.c | 33 +-------------------------------- src/regint.h | 7 ------- 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/src/regcomp.c b/src/regcomp.c index f953ed1..bf04c4d 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -374,17 +374,6 @@ add_bitset(regex_t* reg, BitSetRef bs) return 0; } -static int -add_opcode_option(regex_t* reg, int opcode, OnigOptionType option) -{ - int r; - - r = add_opcode(reg, opcode); - if (r != 0) return r; - r = add_option(reg, option); - return r; -} - static int compile_length_tree(Node* node, regex_t* reg); static int compile_tree(Node* node, regex_t* reg, ScanEnv* env); @@ -1011,14 +1000,7 @@ compile_length_option_node(EnclosureNode* node, regex_t* reg) tlen = compile_length_tree(NODE_ENCLOSURE_BODY(node), reg); reg->options = prev; - if (tlen < 0) return tlen; - - if (IS_DYNAMIC_OPTION(prev ^ node->option)) { - return SIZE_OP_SET_OPTION_PUSH + SIZE_OP_SET_OPTION + SIZE_OP_FAIL - + tlen + SIZE_OP_SET_OPTION; - } - else - return tlen; + return tlen; } static int @@ -1027,23 +1009,10 @@ compile_option_node(EnclosureNode* node, regex_t* reg, ScanEnv* env) int r; OnigOptionType prev = reg->options; - if (IS_DYNAMIC_OPTION(prev ^ node->o.options)) { - r = add_opcode_option(reg, OP_SET_OPTION_PUSH, node->o.options); - if (r != 0) return r; - r = add_opcode_option(reg, OP_SET_OPTION, prev); - if (r != 0) return r; - r = add_opcode(reg, OP_FAIL); - if (r != 0) return r; - } - reg->options = node->o.options; r = compile_tree(NODE_ENCLOSURE_BODY(node), reg, env); reg->options = prev; - if (IS_DYNAMIC_OPTION(prev ^ node->o.options)) { - if (r != 0) return r; - r = add_opcode_option(reg, OP_SET_OPTION, prev); - } return r; } diff --git a/src/regint.h b/src/regint.h index 357b489..920a2ef 100644 --- a/src/regint.h +++ b/src/regint.h @@ -424,13 +424,6 @@ typedef unsigned int MemStatusType; ((ctype) == ONIGENC_CTYPE_DIGIT && IS_DIGIT_ASCII(options)) ||\ ((ctype) == ONIGENC_CTYPE_SPACE && IS_SPACE_ASCII(options)))) -/* OP_SET_OPTION is required for these options. -#define IS_DYNAMIC_OPTION(option) \ - (((option) & (ONIG_OPTION_MULTILINE | ONIG_OPTION_IGNORECASE)) != 0) -*/ -/* ignore-case and multibyte status are included in compiled code. */ -#define IS_DYNAMIC_OPTION(option) 0 - #define DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag) \ ((case_fold_flag) & ~INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) -- 2.40.0