diff options
author | K.Kosako <kosako@sofnec.co.jp> | 2018-11-06 17:17:57 +0900 |
---|---|---|
committer | K.Kosako <kosako@sofnec.co.jp> | 2018-11-06 17:17:57 +0900 |
commit | 004cd19de60c91f317eba470176a531e5ab67a2b (patch) | |
tree | e0ab393c2529f0624c4dc79c95a0f49ffe34bda4 | |
parent | c353426a0d0f469b8839d75b8895c8d7053062da (diff) | |
download | oniguruma-004cd19de60c91f317eba470176a531e5ab67a2b.zip oniguruma-004cd19de60c91f317eba470176a531e5ab67a2b.tar.gz oniguruma-004cd19de60c91f317eba470176a531e5ab67a2b.tar.bz2 |
refactoring
-rw-r--r-- | src/regcomp.c | 4 | ||||
-rw-r--r-- | src/regparse.c | 36 | ||||
-rw-r--r-- | src/regparse.h | 2 |
3 files changed, 21 insertions, 21 deletions
diff --git a/src/regcomp.c b/src/regcomp.c index 60878c8..400368d 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -163,7 +163,7 @@ swap_node(Node* a, Node* b) if (NODE_TYPE(a) == NODE_STRING) { StrNode* sn = STR_(a); - if (sn->capa == 0) { + if (sn->capacity == 0) { int len = (int )(sn->end - sn->s); sn->s = sn->buf; sn->end = sn->s + len; @@ -172,7 +172,7 @@ swap_node(Node* a, Node* b) if (NODE_TYPE(b) == NODE_STRING) { StrNode* sn = STR_(b); - if (sn->capa == 0) { + if (sn->capacity == 0) { int len = (int )(sn->end - sn->s); sn->s = sn->buf; sn->end = sn->s + len; diff --git a/src/regparse.c b/src/regparse.c index 49e1311..9e42e71 100644 --- a/src/regparse.c +++ b/src/regparse.c @@ -2005,7 +2005,7 @@ onig_node_free(Node* node) switch (NODE_TYPE(node)) { case NODE_STRING: - if (STR_(node)->capa != 0 && + if (STR_(node)->capacity != 0 && IS_NOT_NULL(STR_(node)->s) && STR_(node)->s != STR_(node)->buf) { xfree(STR_(node)->s); } @@ -3102,11 +3102,11 @@ onig_node_str_cat(Node* node, const UChar* s, const UChar* end) if (addlen > 0) { int len = (int )(STR_(node)->end - STR_(node)->s); - if (STR_(node)->capa > 0 || (len + addlen > NODE_STRING_BUF_SIZE - 1)) { + if (STR_(node)->capacity > 0 || (len + addlen > NODE_STRING_BUF_SIZE - 1)) { UChar* p; int capa = len + addlen + NODE_STRING_MARGIN; - if (capa <= STR_(node)->capa) { + if (capa <= STR_(node)->capacity) { onig_strcpy(STR_(node)->s + len, s, end); } else { @@ -3117,8 +3117,8 @@ onig_node_str_cat(Node* node, const UChar* s, const UChar* end) p = strcat_capa(STR_(node)->s, STR_(node)->end, s, end, capa); CHECK_NULL_RETURN_MEMERR(p); - STR_(node)->s = p; - STR_(node)->capa = capa; + STR_(node)->s = p; + STR_(node)->capacity = capa; } } else { @@ -3150,24 +3150,24 @@ extern void onig_node_conv_to_str_node(Node* node, int flag) { NODE_SET_TYPE(node, NODE_STRING); - STR_(node)->flag = flag; - STR_(node)->capa = 0; - STR_(node)->s = STR_(node)->buf; - STR_(node)->end = STR_(node)->buf; + STR_(node)->flag = flag; + STR_(node)->capacity = 0; + STR_(node)->s = STR_(node)->buf; + STR_(node)->end = STR_(node)->buf; } extern void onig_node_str_clear(Node* node) { - if (STR_(node)->capa != 0 && + if (STR_(node)->capacity != 0 && IS_NOT_NULL(STR_(node)->s) && STR_(node)->s != STR_(node)->buf) { xfree(STR_(node)->s); } - STR_(node)->capa = 0; - STR_(node)->flag = 0; - STR_(node)->s = STR_(node)->buf; - STR_(node)->end = STR_(node)->buf; + STR_(node)->capacity = 0; + STR_(node)->flag = 0; + STR_(node)->s = STR_(node)->buf; + STR_(node)->end = STR_(node)->buf; } static Node* @@ -3177,10 +3177,10 @@ node_new_str(const UChar* s, const UChar* end) CHECK_NULL_RETURN(node); NODE_SET_TYPE(node, NODE_STRING); - STR_(node)->capa = 0; - STR_(node)->flag = 0; - STR_(node)->s = STR_(node)->buf; - STR_(node)->end = STR_(node)->buf; + STR_(node)->capacity = 0; + STR_(node)->flag = 0; + STR_(node)->s = STR_(node)->buf; + STR_(node)->end = STR_(node)->buf; if (onig_node_str_cat(node, s, end)) { onig_node_free(node); return NULL; diff --git a/src/regparse.h b/src/regparse.h index 5239464..ede9bb8 100644 --- a/src/regparse.h +++ b/src/regparse.h @@ -81,7 +81,7 @@ typedef struct { UChar* s; UChar* end; unsigned int flag; - int capa; /* (allocated size - 1) or 0: use buf[] */ + int capacity; /* (allocated size - 1) or 0: use buf[] */ UChar buf[NODE_STRING_BUF_SIZE]; } StrNode; |