From: K.Kosako Date: Tue, 11 Jul 2017 04:20:47 +0000 (+0900) Subject: add node_new_anychar_with_fixed_option() X-Git-Tag: v6.5.0^2~120 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0162548c52d02c8833743e362394df6a06f5a1d4;p=onig add node_new_anychar_with_fixed_option() --- diff --git a/src/regparse.c b/src/regparse.c index f23b3e6..a25292b 100644 --- a/src/regparse.c +++ b/src/regparse.c @@ -1236,6 +1236,19 @@ node_new_anychar(void) return node; } +static Node* +node_new_anychar_with_fixed_option(OnigOptionType option) +{ + CtypeNode* ct; + Node* node; + + node = node_new_anychar(); + ct = CTYPE_(node); + ct->option = option; + NODE_STATUS_ADD(node, NST_FIXED_OPTION); + return node; +} + static Node* node_new_list(Node* left, Node* right) { @@ -2390,22 +2403,11 @@ node_new_general_newline(Node** node, ScanEnv* env) static int node_new_no_newline(Node** node, ScanEnv* env) { - Node* a; - Node* o; - OnigOptionType option = env->option; - - OPTION_OFF(option, ONIG_OPTION_MULTILINE); - - a = node_new_anychar(); - CHECK_NULL_RETURN_MEMERR(a); - o = node_new_option(option); - if (IS_NULL(o)) { - onig_node_free(a); - return ONIGERR_MEMORY; - } - NODE_BODY(o) = a; + Node* n; - *node = o; + n = node_new_anychar_with_fixed_option(ONIG_OPTION_NONE); + CHECK_NULL_RETURN_MEMERR(n); + *node = n; return 0; }