From patchwork Fri Dec 8 09:16:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnold Robbins X-Patchwork-Id: 24795 Received: (qmail 69420 invoked by alias); 8 Dec 2017 09:18:17 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 61191 invoked by uid 89); 8 Dec 2017 09:17:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, MANY_HDRS_LCASE, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=robbins, Arnold, arnold, HContent-type:text X-HELO: mxout4.netvision.net.il MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII From: Arnold Robbins Message-id: <201712080916.vB89Gx7W005505@skeeve.com> Date: Fri, 08 Dec 2017 11:16:59 +0200 To: carlos@redhat.com, libc-alpha@sourceware.org Subject: [PATCH 08/17] Regex: Remove unnecessary variables. User-Agent: Heirloom mailx 12.5 6/20/10 This patch removes a number of unnecessary and/or unused variables, making the code simpler and cleaner. 2017-11-27 Arnold D. Robbins * 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))