diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2019-10-11 18:23:47 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2019-10-11 18:24:19 -0700 |
commit | 4b60e0722d0a79751f345bd470d07db0d635aa28 (patch) | |
tree | 9ebcaa21ec5f08c0caafc7190daf34ed047f8e1f /lib/regcomp.c | |
parent | f9d8babe6a28b19c781778c361e45b93f7a01f17 (diff) | |
download | emacs-4b60e0722d0a79751f345bd470d07db0d635aa28.tar.gz emacs-4b60e0722d0a79751f345bd470d07db0d635aa28.tar.bz2 emacs-4b60e0722d0a79751f345bd470d07db0d635aa28.zip |
Update from Gnulib
This incorporates:
2019-10-11 Simplify and regularize regex use of ‘assert’
2019-10-09 regex: omit debug assignment when not debugging
2019-10-09 regex: tell compiler there’s at most 256 arcs out
2019-10-09 regex: simplify by assuming C99
2019-10-09 regex: avoid copying of uninitialized storage
2019-09-29 fbufmode: Fix compilation error on glibc >= 2.28 systems
2019-09-28 Update comments that refer to POSIX
2019-09-23 Update URLs and associated text
* doc/misc/texinfo.tex, lib/open.c, lib/regcomp.c:
* lib/regex_internal.c, lib/regex_internal.h, lib/regexec.c:
* lib/stdio-impl.h:
Copy from Gnulib.
Diffstat (limited to 'lib/regcomp.c')
-rw-r--r-- | lib/regcomp.c | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/lib/regcomp.c b/lib/regcomp.c index 892139a02af..ad6f931a5c3 100644 --- a/lib/regcomp.c +++ b/lib/regcomp.c @@ -1436,7 +1436,7 @@ link_nfa_nodes (void *extra, bin_tree_t *node) break; case END_OF_RE: - assert (node->next == NULL); + DEBUG_ASSERT (node->next == NULL); break; case OP_DUP_ASTERISK: @@ -1452,8 +1452,8 @@ link_nfa_nodes (void *extra, bin_tree_t *node) right = node->right->first->node_idx; else right = node->next->node_idx; - assert (left > -1); - assert (right > -1); + DEBUG_ASSERT (left > -1); + DEBUG_ASSERT (right > -1); err = re_node_set_init_2 (dfa->edests + idx, left, right); } break; @@ -1471,7 +1471,7 @@ link_nfa_nodes (void *extra, bin_tree_t *node) break; default: - assert (!IS_EPSILON_NODE (node->token.type)); + DEBUG_ASSERT (!IS_EPSILON_NODE (node->token.type)); dfa->nexts[idx] = node->next->node_idx; break; } @@ -1653,9 +1653,7 @@ calc_eclosure (re_dfa_t *dfa) { Idx node_idx; bool incomplete; -#ifdef DEBUG - assert (dfa->nodes_len > 0); -#endif + DEBUG_ASSERT (dfa->nodes_len > 0); incomplete = false; /* For each nodes, calculate epsilon closure. */ for (node_idx = 0; ; ++node_idx) @@ -1670,9 +1668,7 @@ calc_eclosure (re_dfa_t *dfa) node_idx = 0; } -#ifdef DEBUG - assert (dfa->eclosures[node_idx].nelem != -1); -#endif + DEBUG_ASSERT (dfa->eclosures[node_idx].nelem != -1); /* If we have already calculated, skip it. */ if (dfa->eclosures[node_idx].nelem != 0) @@ -2442,9 +2438,7 @@ parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token, default: /* Must not happen? */ -#ifdef DEBUG - assert (0); -#endif + DEBUG_ASSERT (false); return NULL; } fetch_token (token, regexp, syntax); @@ -3306,7 +3300,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, goto parse_bracket_exp_free_return; break; default: - assert (0); + DEBUG_ASSERT (false); break; } } @@ -3662,7 +3656,6 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, Idx alloc = 0; #endif /* not RE_ENABLE_I18N */ reg_errcode_t ret; - re_token_t br_token; bin_tree_t *tree; sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1); @@ -3713,11 +3706,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, #endif /* Build a tree for simple bracket. */ -#if defined GCC_LINT || defined lint - memset (&br_token, 0, sizeof br_token); -#endif - br_token.type = SIMPLE_BRACKET; - br_token.opr.sbcset = sbcset; + re_token_t br_token = { .type = SIMPLE_BRACKET, .opr.sbcset = sbcset }; tree = create_token_tree (dfa, NULL, NULL, &br_token); if (__glibc_unlikely (tree == NULL)) goto build_word_op_espace; @@ -3808,11 +3797,7 @@ static bin_tree_t * create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right, re_token_type_t type) { - re_token_t t; -#if defined GCC_LINT || defined lint - memset (&t, 0, sizeof t); -#endif - t.type = type; + re_token_t t = { .type = type }; return create_token_tree (dfa, left, right, &t); } |