From patchwork Wed Jan 6 18:17:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 41653 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2594B384A01D; Wed, 6 Jan 2021 18:17:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2594B384A01D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1609957037; bh=bSG98HhOdHT7GRu3yAQJ2DZEo3nNeRaAdFFFPI1mzPE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=gMj4ossqXg6WJJvo2vNGCJ6EVs9nJre2XjsaJcy7J6St/9zx8W4A9lUVGEIIy3Dmz Kxzj4kIuDqIrJLX+zSHlgdHR01TuR7TMuAdW1JdI4oNlWewyfosmsRJpZvw4HzxFT0 6iG55GhjXctMqR5NkGz+g3hD0gzcnVC6bxff+D1I= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by sourceware.org (Postfix) with ESMTPS id C333C384A87C for ; Wed, 6 Jan 2021 18:17:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C333C384A87C Received: by mail-qt1-x836.google.com with SMTP id b9so2653036qtr.2 for ; Wed, 06 Jan 2021 10:17:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=bSG98HhOdHT7GRu3yAQJ2DZEo3nNeRaAdFFFPI1mzPE=; b=EKcwiL4GePbJiluZeA0c4YwrZqiYhJqqjrl8IqiBx1+/2ymZ5HJwr4sKMCXjTQ2GZ1 WsNffoLJa7N8r1rkWO0B4xV6CcL7QaHNiLpgNpVI4mnnZDWSkevLgiAGkZ3stZNNJ/B9 4r1F7yOvyFiwRgl0CqdbVwuf4KjQ3KK8ASKmBIiDvxEpLupjdXvj7LUO+UiMogd40YeY 3Shj+ZYPPK1h3BkhTIYqXV9kTyBvKsXmrxHVGYFAAMp3Waa/+IVVSdjs2LxLhx+HX5yd vQ4hhKZq+YXEHYoUE3XxvDUt34Eex1nli3Ma3qub0E12frgY354LcHbHU2swg2WaexbE z2mQ== X-Gm-Message-State: AOAM533uh7BavyXqsq/zzYjuZg1XhY93ofc+SxR8flZZRRC52Q6D4oAG vW01mjf1RXk7tGGo4yKX7T3ABBxFgmPbSQ== X-Google-Smtp-Source: ABdhPJzhgzvvFZ4eTV4cxTgT7vR0aNvGA7xfykn/lav/LFX1EVLcZvuV5mCfYWPyV6oL0Z8XTYNrAg== X-Received: by 2002:aed:30d1:: with SMTP id 75mr5125547qtf.61.1609957032979; Wed, 06 Jan 2021 10:17:12 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id a194sm1762745qkc.70.2021.01.06.10.17.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 10:17:12 -0800 (PST) To: libc-alpha@sourceware.org, Paul Eggert , bug-gnulib@gnu.org Subject: [PATCH 1/3] posix: Remove alloca usage on regex set_regs Date: Wed, 6 Jan 2021 15:17:05 -0300 Message-Id: <20210106181707.1738066-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" It replaces the regmatch_t with a dynarray list. Checked on x86_64-linux-gnu. --- posix/regexec.c | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/posix/regexec.c b/posix/regexec.c index b083342f77..5e22f90842 100644 --- a/posix/regexec.c +++ b/posix/regexec.c @@ -54,9 +54,6 @@ static Idx check_matching (re_match_context_t *mctx, bool fl_longest_match, Idx *p_match_first); static Idx check_halt_state_context (const re_match_context_t *mctx, const re_dfastate_t *state, Idx idx); -static void update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, - regmatch_t *prev_idx_match, Idx cur_node, - Idx cur_idx, Idx nmatch); static reg_errcode_t push_fail_stack (struct re_fail_stack_t *fs, Idx str_idx, Idx dest_node, Idx nregs, regmatch_t *regs, @@ -1355,6 +1352,16 @@ pop_fail_stack (struct re_fail_stack_t *fs, Idx *pidx, Idx nregs, return fs->stack[num].node; } + +#define DYNARRAY_STRUCT regmatch_list +#define DYNARRAY_ELEMENT regmatch_t +#define DYNARRAY_PREFIX regmatch_list_ +#include + +static void update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, + struct regmatch_list *prev_idx_match, Idx cur_node, + Idx cur_idx, Idx nmatch); + /* Set the positions where the subexpressions are starts/ends to registers PMATCH. Note: We assume that pmatch[0] is already set, and @@ -1370,8 +1377,8 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, re_node_set eps_via_nodes; struct re_fail_stack_t *fs; struct re_fail_stack_t fs_body = { 0, 2, NULL }; - regmatch_t *prev_idx_match; - bool prev_idx_match_malloced = false; + struct regmatch_list prev_idx_match; + regmatch_list_init (&prev_idx_match); DEBUG_ASSERT (nmatch > 1); DEBUG_ASSERT (mctx->state_log != NULL); @@ -1388,23 +1395,18 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, cur_node = dfa->init_node; re_node_set_init_empty (&eps_via_nodes); - if (__libc_use_alloca (nmatch * sizeof (regmatch_t))) - prev_idx_match = (regmatch_t *) alloca (nmatch * sizeof (regmatch_t)); - else + if (!regmatch_list_resize (&prev_idx_match, nmatch)) { - prev_idx_match = re_malloc (regmatch_t, nmatch); - if (prev_idx_match == NULL) - { - free_fail_stack_return (fs); - return REG_ESPACE; - } - prev_idx_match_malloced = true; + regmatch_list_free (&prev_idx_match); + free_fail_stack_return (fs); + return REG_ESPACE; } - memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch); + for (size_t i = 0; i < nmatch; i++) + *regmatch_list_at (&prev_idx_match, i) = pmatch[i]; for (idx = pmatch[0].rm_so; idx <= pmatch[0].rm_eo ;) { - update_regs (dfa, pmatch, prev_idx_match, cur_node, idx, nmatch); + update_regs (dfa, pmatch, &prev_idx_match, cur_node, idx, nmatch); if (idx == pmatch[0].rm_eo && cur_node == mctx->last_node) { @@ -1417,8 +1419,7 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, if (reg_idx == nmatch) { re_node_set_free (&eps_via_nodes); - if (prev_idx_match_malloced) - re_free (prev_idx_match); + regmatch_list_free (&prev_idx_match); return free_fail_stack_return (fs); } cur_node = pop_fail_stack (fs, &idx, nmatch, pmatch, @@ -1427,8 +1428,7 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, else { re_node_set_free (&eps_via_nodes); - if (prev_idx_match_malloced) - re_free (prev_idx_match); + regmatch_list_free (&prev_idx_match); return REG_NOERROR; } } @@ -1442,8 +1442,7 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, if (__glibc_unlikely (cur_node == -2)) { re_node_set_free (&eps_via_nodes); - if (prev_idx_match_malloced) - re_free (prev_idx_match); + regmatch_list_free (&prev_idx_match); free_fail_stack_return (fs); return REG_ESPACE; } @@ -1453,15 +1452,13 @@ set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch, else { re_node_set_free (&eps_via_nodes); - if (prev_idx_match_malloced) - re_free (prev_idx_match); + regmatch_list_free (&prev_idx_match); return REG_NOMATCH; } } } re_node_set_free (&eps_via_nodes); - if (prev_idx_match_malloced) - re_free (prev_idx_match); + regmatch_list_free (&prev_idx_match); return free_fail_stack_return (fs); } @@ -1483,7 +1480,8 @@ free_fail_stack_return (struct re_fail_stack_t *fs) static void update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, - regmatch_t *prev_idx_match, Idx cur_node, Idx cur_idx, Idx nmatch) + struct regmatch_list *prev_idx_match, Idx cur_node, Idx cur_idx, + Idx nmatch) { int type = dfa->nodes[cur_node].type; if (type == OP_OPEN_SUBEXP) @@ -1508,18 +1506,20 @@ update_regs (const re_dfa_t *dfa, regmatch_t *pmatch, pmatch[reg_num].rm_eo = cur_idx; /* This is a non-empty match or we are not inside an optional subexpression. Accept this right away. */ - memcpy (prev_idx_match, pmatch, sizeof (regmatch_t) * nmatch); + for (size_t i = 0; i < nmatch; i++) + *regmatch_list_at (prev_idx_match, i) = pmatch[i]; } else { if (dfa->nodes[cur_node].opt_subexp - && prev_idx_match[reg_num].rm_so != -1) + && regmatch_list_at (prev_idx_match, reg_num)->rm_so != -1) /* We transited through an empty match for an optional subexpression, like (a?)*, and this is not the subexp's first match. Copy back the old content of the registers so that matches of an inner subexpression are undone as well, like in ((a?))*. */ - memcpy (pmatch, prev_idx_match, sizeof (regmatch_t) * nmatch); + memcpy (pmatch, regmatch_list_begin (prev_idx_match), + sizeof (regmatch_t) * nmatch); else /* We completed a subexpression, but it may be part of an optional one, so do not update PREV_IDX_MATCH. */ From patchwork Wed Jan 6 18:17:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 41654 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A9365384A023; Wed, 6 Jan 2021 18:17:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9365384A023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1609957038; bh=GU1hEC5klfjsdexKzmGn5GlVxjBJq1i1Lx/CdWKSiyA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=HFZ31EeUXX3PjZtpxiMz5RY05hLOKGuxsj7cywG8az4OyMKD+4aawSwHdklqhs40W f1CrocvS9d/PQGaozHekiRf4LzDXdYKAfvma0GvbrjuA3umsPlLhpHwpGno4dU2bxk dKFvnC+jN9ScamPQdi95dseLtvkcKBznAXstvW3E= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by sourceware.org (Postfix) with ESMTPS id D8FAF384A87C for ; Wed, 6 Jan 2021 18:17:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D8FAF384A87C Received: by mail-qv1-xf30.google.com with SMTP id l14so1644903qvh.2 for ; Wed, 06 Jan 2021 10:17:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GU1hEC5klfjsdexKzmGn5GlVxjBJq1i1Lx/CdWKSiyA=; b=gOLn0jzwRf+PBTgTXsgwPyF6aKTJqzFBXae8zLf6EHXkzjv0VTecVw+FTTeAo39Odb SXSpCfO2HLCrDIZzs6M+PSa4cWigpkGkHaORt9UNaRsqNNcrAazY4PKJgLair2KiH5Yh nMAQCJa6BtWqfQem2onMlNQga0/k4Ey3Ys02jBR/wmV2NSlTkAIyt+DPSvP+MD0r8PoC FdNfQkatrnPvM3sWB+KyIBXGhtiIvMjn6G9pEvt3xt6x0mJMBFRCu/KzqtJaCCveeMuD ByT7EM8PeZ9ciptda1SdHpR0pn3STk/iqSh1oZykxKD4/78dr3MTCSHK1liD1TrqJvDw 5B6A== X-Gm-Message-State: AOAM530mrQWryLK8wQzYHaesZOsxeKuMWbLduwarTWERxI1dgGt8zRhL PiRpaOAqH41e6gB/mkO9x/xcFFfcPbU5+A== X-Google-Smtp-Source: ABdhPJymbki5FpmVyQs34JHcVG3uqJmHAFRlQM/aTcEaSaOvMHwfieYFFvkbIyWaV4M0XVUCxY049A== X-Received: by 2002:a0c:a994:: with SMTP id a20mr5077756qvb.30.1609957034769; Wed, 06 Jan 2021 10:17:14 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id a194sm1762745qkc.70.2021.01.06.10.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 10:17:14 -0800 (PST) To: libc-alpha@sourceware.org, Paul Eggert , bug-gnulib@gnu.org Subject: [PATCH 2/3] posix: Remove alloca usage on regex build_trtable Date: Wed, 6 Jan 2021 15:17:06 -0300 Message-Id: <20210106181707.1738066-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210106181707.1738066-1-adhemerval.zanella@linaro.org> References: <20210106181707.1738066-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" __libc_use_alloca/alloca is replaced with malloc regardless. Checked on x86_64-linux-gnu. --- posix/regexec.c | 50 +++++++++++++++---------------------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/posix/regexec.c b/posix/regexec.c index 5e22f90842..a8e9a9cd01 100644 --- a/posix/regexec.c +++ b/posix/regexec.c @@ -3259,8 +3259,6 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) int ch; bool need_word_trtable = false; bitset_word_t elem, mask; - bool dests_node_malloced = false; - bool dest_states_malloced = false; Idx ndests; /* Number of the destination states from 'state'. */ re_dfastate_t **trtable; re_dfastate_t **dest_states = NULL, **dest_states_word, **dest_states_nl; @@ -3278,15 +3276,9 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) from 'state'. 'dests_node[i]' represents the nodes which i-th destination state contains, and 'dests_ch[i]' represents the characters which i-th destination state accepts. */ - if (__libc_use_alloca (sizeof (struct dests_alloc))) - dests_alloc = (struct dests_alloc *) alloca (sizeof (struct dests_alloc)); - else - { - dests_alloc = re_malloc (struct dests_alloc, 1); - if (__glibc_unlikely (dests_alloc == NULL)) - return false; - dests_node_malloced = true; - } + dests_alloc = re_malloc (struct dests_alloc, 1); + if (__glibc_unlikely (dests_alloc == NULL)) + return false; dests_node = dests_alloc->dests_node; dests_ch = dests_alloc->dests_ch; @@ -3298,8 +3290,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) ndests = group_nodes_into_DFAstates (dfa, state, dests_node, dests_ch); if (__glibc_unlikely (ndests <= 0)) { - if (dests_node_malloced) - re_free (dests_alloc); + re_free (dests_alloc); /* Return false in case of an error, true otherwise. */ if (ndests == 0) { @@ -3323,26 +3314,17 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state) if (__glibc_unlikely (ndests_max < ndests)) goto out_free; - if (__libc_use_alloca ((sizeof (re_node_set) + sizeof (bitset_t)) * SBC_MAX - + ndests * 3 * sizeof (re_dfastate_t *))) - dest_states = (re_dfastate_t **) - alloca (ndests * 3 * sizeof (re_dfastate_t *)); - else + dest_states = + re_malloc (re_dfastate_t *, ndests * 3 * sizeof (re_dfastate_t *)); + if (__glibc_unlikely (dest_states == NULL)) { - dest_states = re_malloc (re_dfastate_t *, ndests * 3); - if (__glibc_unlikely (dest_states == NULL)) - { out_free: - if (dest_states_malloced) - re_free (dest_states); - re_node_set_free (&follows); - for (i = 0; i < ndests; ++i) - re_node_set_free (dests_node + i); - if (dests_node_malloced) - re_free (dests_alloc); - return false; - } - dest_states_malloced = true; + re_free (dest_states); + re_node_set_free (&follows); + for (i = 0; i < ndests; ++i) + re_node_set_free (dests_node + i); + re_free (dests_alloc); + return false; } dest_states_word = dest_states + ndests; dest_states_nl = dest_states_word + ndests; @@ -3470,15 +3452,13 @@ out_free: } } - if (dest_states_malloced) - re_free (dest_states); + re_free (dest_states); re_node_set_free (&follows); for (i = 0; i < ndests; ++i) re_node_set_free (dests_node + i); - if (dests_node_malloced) - re_free (dests_alloc); + re_free (dests_alloc); return true; } From patchwork Wed Jan 6 18:17:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 41655 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AFB4C394D89C; Wed, 6 Jan 2021 18:17:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AFB4C394D89C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1609957039; bh=uCy6JP5EA/CqN/tzQUDKLZbkH9wKQ+HMZPRfuEQLkb4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Rg0SOQbe4axuvrsHo9aI29lDIRgwWYGV/9eEUpeWFOZ8Po8m3SZylqbnFH2vQ+g+2 PH3OjEqQyQZXNpVuWfoY9kXeBTgJE8i02XgmqhLRPnNrDI5Zid+ultZrfAXrNG7H28 Vl6uSsRUh/zoydJOB6RuEZmKtDtE0rRjWGOBNBeg= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by sourceware.org (Postfix) with ESMTPS id 7DAAE384A022 for ; Wed, 6 Jan 2021 18:17:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7DAAE384A022 Received: by mail-qv1-xf2f.google.com with SMTP id et9so1611467qvb.10 for ; Wed, 06 Jan 2021 10:17:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uCy6JP5EA/CqN/tzQUDKLZbkH9wKQ+HMZPRfuEQLkb4=; b=X4aqawKrTxEcr1akoLpyBX02jGJxVUMQ/w4Wd2GyN9lINUNJeiwt8fN55V9qIJf53v cqSV6R6NV7x0oIGvsYGEzUFOI8y3vMLklk3uUCBoHA6ItiUGPsm0OLDjEqG70WWtfKkF qejK5kr5gMAhI02X2mLHyQXJUiTOsNtFbaPqsQbI9OCEl3n6cUPJUDu42gvk91kSw7xm f1Bo5RuspSfZbB9+uIWB2xnVZxa4Y49d1+4qE/b1A4MpXEH3zBtcXMl6D2P1FQ9jevlO AcDf6bJzedQuS+yCdwDxUmzrY7Pt9MZiGkvJ5ySxFzHhSbqLrwx0vJp+ABBbBsJYr8J4 HVsQ== X-Gm-Message-State: AOAM533LBrAcvUpR+ii+K3yZYFjDZZj+SZPhjjFVy5p0l8732K4hPsyH Urykb6W/dq/GK1xbq2yrDclmVT0Kb9JorA== X-Google-Smtp-Source: ABdhPJzkzW9AickTuqlgx2gLgXRLiFXHwSDwRbh/Bdz1TbIWSqxb6yPidBGuPwFXwhezTxdzdaMy4Q== X-Received: by 2002:a0c:ab8b:: with SMTP id j11mr5285572qvb.0.1609957036908; Wed, 06 Jan 2021 10:17:16 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id a194sm1762745qkc.70.2021.01.06.10.17.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 10:17:16 -0800 (PST) To: libc-alpha@sourceware.org, Paul Eggert , bug-gnulib@gnu.org Subject: [PATCH 3/3] posix: Remove alloca definition from regex Date: Wed, 6 Jan 2021 15:17:07 -0300 Message-Id: <20210106181707.1738066-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210106181707.1738066-1-adhemerval.zanella@linaro.org> References: <20210106181707.1738066-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Since it is not used anymore. No functional changes is expected. Checked on x86_64-linux-gnu. --- posix/regex_internal.h | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/posix/regex_internal.h b/posix/regex_internal.h index e31ac92674..641b27e2b1 100644 --- a/posix/regex_internal.h +++ b/posix/regex_internal.h @@ -444,25 +444,6 @@ typedef struct re_dfa_t re_dfa_t; #define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx)) #define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx)) -#if defined _LIBC || HAVE_ALLOCA -# include -#endif - -#ifndef _LIBC -# if HAVE_ALLOCA -/* The OS usually guarantees only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - allocate anything larger than 4096 bytes. Also care for the possibility - of a few compiler-allocated temporary stack slots. */ -# define __libc_use_alloca(n) ((n) < 4032) -# else -/* alloca is implemented with malloc, so just use malloc. */ -# define __libc_use_alloca(n) 0 -# undef alloca -# define alloca(n) malloc (n) -# endif -#endif - #ifdef _LIBC # define MALLOC_0_IS_NONNULL 1 #elif !defined MALLOC_0_IS_NONNULL