From 08d3d624d9da7371793bc2164f285e2fe694d8ba Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Thu, 28 Mar 2019 09:33:57 +0900 Subject: [PATCH] refactoring --- src/regcomp.c | 14 +++++++------- src/regparse.c | 8 ++++---- src/regparse.h | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/regcomp.c b/src/regcomp.c index 8e246a4..625b3a9 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -952,7 +952,7 @@ compile_length_quantifier_node(QuantNode* qn, regex_t* reg) { int len, mod_tlen; int infinite = IS_REPEAT_INFINITE(qn->upper); - enum QuantBodyEmpty empty_info = qn->body_empty_info; + enum QuantBodyEmpty empty_info = qn->empty_info; int tlen = compile_length_tree(NODE_QUANT_BODY(qn), reg); if (tlen < 0) return tlen; @@ -1027,7 +1027,7 @@ compile_quantifier_node(QuantNode* qn, regex_t* reg, ScanEnv* env) { int i, r, mod_tlen; int infinite = IS_REPEAT_INFINITE(qn->upper); - enum QuantBodyEmpty empty_info = qn->body_empty_info; + enum QuantBodyEmpty empty_info = qn->empty_info; int tlen = compile_length_tree(NODE_QUANT_BODY(qn), reg); if (tlen < 0) return tlen; @@ -4604,15 +4604,15 @@ setup_quant(Node* node, regex_t* reg, int state, ScanEnv* env) d = tree_min_len(body, env); if (d == 0) { #ifdef USE_INSISTENT_CHECK_CAPTURES_IN_EMPTY_REPEAT - qn->body_empty_info = quantifiers_memory_node_info(body); - if (qn->body_empty_info == QUANT_BODY_IS_EMPTY_REC) { + qn->empty_info = quantifiers_memory_node_info(body); + if (qn->empty_info == QUANT_BODY_IS_EMPTY_REC) { if (NODE_TYPE(body) == NODE_BAG && BAG_(body)->type == BAG_MEMORY) { MEM_STATUS_ON(env->bt_mem_end, BAG_(body)->m.regnum); } } #else - qn->body_empty_info = QUANT_BODY_IS_EMPTY; + qn->empty_info = QUANT_BODY_IS_EMPTY; #endif } } @@ -4646,7 +4646,7 @@ setup_quant(Node* node, regex_t* reg, int state, ScanEnv* env) } } - if (qn->greedy && (qn->body_empty_info == QUANT_BODY_IS_NOT_EMPTY)) { + if (qn->greedy && (qn->empty_info == QUANT_BODY_IS_NOT_EMPTY)) { if (NODE_TYPE(body) == NODE_QUANT) { QuantNode* tqn = QUANT_(body); if (IS_NOT_NULL(tqn->head_exact)) { @@ -4663,7 +4663,7 @@ setup_quant(Node* node, regex_t* reg, int state, ScanEnv* env) } /* setup_tree does the following work. - 1. check empty loop. (set qn->body_empty_info) + 1. check empty loop. (set qn->empty_info) 2. expand ignore-case in char class. 3. set memory status bit flags. (reg->mem_stats) 4. set qn->head_exact for [push, exact] -> [push_or_jump_exact1, exact]. diff --git a/src/regparse.c b/src/regparse.c index 222078f..266bc11 100644 --- a/src/regparse.c +++ b/src/regparse.c @@ -2391,10 +2391,10 @@ node_new_quantifier(int lower, int upper, int by_number) CHECK_NULL_RETURN(node); NODE_SET_TYPE(node, NODE_QUANT); - QUANT_(node)->lower = lower; - QUANT_(node)->upper = upper; - QUANT_(node)->greedy = 1; - QUANT_(node)->body_empty_info = QUANT_BODY_IS_NOT_EMPTY; + QUANT_(node)->lower = lower; + QUANT_(node)->upper = upper; + QUANT_(node)->greedy = 1; + QUANT_(node)->empty_info = QUANT_BODY_IS_NOT_EMPTY; QUANT_(node)->head_exact = NULL_NODE; QUANT_(node)->next_head_exact = NULL_NODE; QUANT_(node)->is_refered = 0; diff --git a/src/regparse.h b/src/regparse.h index 5818c54..ae2e940 100644 --- a/src/regparse.h +++ b/src/regparse.h @@ -101,7 +101,7 @@ typedef struct { int lower; int upper; int greedy; - enum QuantBodyEmpty body_empty_info; + enum QuantBodyEmpty empty_info; struct _Node* head_exact; struct _Node* next_head_exact; int is_refered; /* include called node. don't eliminate even if {0} */ -- 2.40.0