This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 08/17] Regex: Remove unnecessary variables.
- From: Arnold Robbins <arnold at skeeve dot com>
- To: carlos at redhat dot com, libc-alpha at sourceware dot org
- Date: Fri, 08 Dec 2017 11:16:59 +0200
- Subject: [PATCH 08/17] Regex: Remove unnecessary variables.
- Authentication-results: sourceware.org; auth=none
This patch removes a number of unnecessary and/or unused variables,
making the code simpler and cleaner.
2017-11-27 Arnold D. Robbins <arnold@skeeve.com>
* posix/regex_internal.c (re_node_set_remove_at): Remove unnecessary
variables.
(re_dfa_add_node): Ditto.
* posix/regexec.c (regexec): Ditto.
(re_search_stub): Ditto.
diff --git a/posix/regex_internal.c b/posix/regex_internal.c
index 968fd77..19c1bd8 100644
--- a/posix/regex_internal.c
+++ b/posix/regex_internal.c
@@ -1408,7 +1408,6 @@ re_node_set_remove_at (re_node_set *set, int idx)
static int
re_dfa_add_node (re_dfa_t *dfa, re_token_t token)
{
- int type = token.type;
if (BE (dfa->nodes_len >= dfa->nodes_alloc, 0))
{
size_t new_nodes_alloc = dfa->nodes_alloc * 2;
@@ -1455,7 +1454,7 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token)
dfa->nodes[dfa->nodes_len].constraint = 0;
#ifdef RE_ENABLE_I18N
dfa->nodes[dfa->nodes_len].accept_mb =
- (type == OP_PERIOD && dfa->mb_cur_max > 1) || type == COMPLEX_BRACKET;
+ (token.type == OP_PERIOD && dfa->mb_cur_max > 1) || token.type == COMPLEX_BRACKET;
#endif
dfa->nexts[dfa->nodes_len] = -1;
re_node_set_init_empty (dfa->edests + dfa->nodes_len);
diff --git a/posix/regexec.c b/posix/regexec.c
index 8573765..c73294e 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -196,7 +196,6 @@ regexec (const regex_t *__restrict preg, const char *__restrict string,
{
reg_errcode_t err;
int start, length;
- re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND))
return REG_BADPAT;
@@ -372,7 +371,6 @@ re_search_stub (struct re_pattern_buffer *bufp, const char *string, int length,
regmatch_t *pmatch;
int nregs, rval;
int eflags = 0;
- re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
/* Check for out-of-range. */
if (BE (start < 0 || start > length, 0))
--
2.7.4