From patchwork Thu Jun 8 21:13:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 103419 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp2633071qgd; Thu, 8 Jun 2017 14:16:38 -0700 (PDT) X-Received: by 10.98.27.215 with SMTP id b206mr5092466pfb.123.1496956598431; Thu, 08 Jun 2017 14:16:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496956598; cv=none; d=google.com; s=arc-20160816; b=qKmfg4+JVPf+qVL4pPzO3IXk4qhnukCRs8q8zM/huPA9kGYOeKVl438+QZDGL+MOHv Ls5wmczph84M73fyAHSc7tEHKWn7OZM04raqeUciJ/LF3ex0IUDRFMU/vldgziYZdS3/ yHqeIU5+VfZXPOblMuzOt2tCZV9k0jH0/YHxlMt1Mi1Mia5hrAHJoq3EXtMzKhx9AzEp rjPhgQ34dTsTrhn0wQ946LQN2HHD6uOOr2oDntuQb+4XwjEneZwrJ6NxDzoWvfMvRvcW 8l7mCA5qUmiA/b2YgtbJu1Thgma2l7cyAp2s7Xc1pfb9c4I5uvk5+FEcmZbjnxO0ahwv NlYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from:delivered-to :sender:list-help:list-post:list-archive:list-subscribe :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=UeGAaHlQ3G8+ljnzbv9JSJ5wAho2dk7MQtmFARw9L4w=; b=Pso4HR39sts0LoXau2U5EHfILI4smm/KZvBZhRWfpjDcF9iGcJmPVY1Y93OqNK9RjK 8hEITHaRUcAvRzOElhVMQNth3YzNxNnuyhzsCvZ96gBTX0tLC/I0QIta8bN9NS2K8AYJ bN5gOu/k5rVs6zoJBVxJ1aV1u9vBBlSA4iEM1NSjWIpvlT+NCk7zZXeabkLCzMKUMW7A a+UiT0rVy0KHS3Gj+eAspj3YnfIuUy9lklNLWUn4gEWXNFoNYxFw9GT626Arl4tyobpY D1S/fU0BV9VM4xTFv6rtax7lPOOXbnM/mQ+I4KfBhtWGsL8WK1Cl4uR2cyZKV91xM9mS naQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-80213-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-80213-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id m9si5158188pln.442.2017.06.08.14.16.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 14:16:38 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-80213-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-80213-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-80213-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=SJ0IP92+1caGZQmOsAxAatup33JRpcx SrzCnjEC4kNmabAriYskDthX2yO9/HC6el3R4EWggXou+NoX1bhmUvq2ojt/JNwE 8ofRAg2S0kz0ty9g/IOp9lhzM8Gh4NP87StdpWi5xeuvVWXK81TNVZ780gJhGL/0 sOHOUfyj08l8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=cccF/v4VnWmFLbkFNagd8d6u300=; b=QsbMm B/nPg2vLsBNrNCdLhgiv0VrMoMFV5fyqdpfq6/Zr+0Bf/+YsHTUSULfOqbUrFg+X 8oV8NHAwGth63bkqGdS0C5O4OqU0d/6i4mxFYHrsmFMgvd42+dDsPUdDorTE2WhF s31uGgUaE0Ae3kXAP9iAJRIxuY5VkkWs3UGDFc= Received: (qmail 40757 invoked by alias); 8 Jun 2017 21:14:18 -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 40536 invoked by uid 89); 8 Jun 2017 21:14:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f177.google.com 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; bh=UeGAaHlQ3G8+ljnzbv9JSJ5wAho2dk7MQtmFARw9L4w=; b=oNXkNKP+N4ERUPZSV3EVyTpLgWkHUkHqzo5mLpjJJK27KOLjkRL6GSPhy+aGVxtEXp AS1CUp0xkP4d6wmMVBDhk6w7kMZ9f/jeRztmxqjZEi6xX4PKFMVizlWorrdAB6Xa+HgW mTeyQkiUWFSRKQy3QQdOCVMdNHxOA7oSLnzJFcEKwcfAAblidhuwdXYSOiHK9FyMEEsE e19vC+sSGNoROUve3yupi/LYf+JOqITlBCrrHhi+m7rqEWCJvOaYkQMYLSqwTqVqkU77 JAeAcYs8Wgl4xAJBM9y24jyo9Wir7fjiFtj8/hoVs9I70gz1kPmnA1f+qn3cIF7JnfXR pRTQ== X-Gm-Message-State: AKS2vOyDp2gmCm1QKK0ejN1VmsBHjN0EDEXglQKX2NBy4uBFCELAT0zi 1I9MESs5D4jlWz97VcQ9ig== X-Received: by 10.55.92.68 with SMTP id q65mr30392566qkb.205.1496956456790; Thu, 08 Jun 2017 14:14:16 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 14/17] posix: Remove all alloca usage in glob Date: Thu, 8 Jun 2017 18:13:28 -0300 Message-Id: <1496956411-25594-15-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1496956411-25594-1-git-send-email-adhemerval.zanella@linaro.org> References: <1496956411-25594-1-git-send-email-adhemerval.zanella@linaro.org> With alloca usage removal from glob this patch wraps it up by removing all the alloca defines and macros usage. Checked on x86_64-linux-gnu. posix/glob.c (glob_in_dir): Remove alloca_used argument. (glob): Remove alloca_used. --- posix/glob.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) -- 2.7.4 diff --git a/posix/glob.c b/posix/glob.c index 62be373..652ae9e 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -58,7 +58,6 @@ #include #include #include -#include #ifdef _LIBC # undef strdup @@ -229,17 +228,11 @@ convert_dirent64 (const struct dirent64 *source) # ifdef GNULIB_defined_closedir # undef closedir # endif - -/* Just use malloc. */ -# define __libc_use_alloca(n) false -# define alloca_account(len, avar) ((void) (len), (void) (avar), (void *) 0) -# define extend_alloca_account(buf, len, newlen, avar) \ - ((void) (buf), (void) (len), (void) (newlen), (void) (avar), (void *) 0) #endif static int glob_in_dir (const char *pattern, const char *directory, int flags, int (*errfunc) (const char *, int), - glob_t *pglob, size_t alloca_used); + glob_t *pglob); extern int __glob_pattern_type (const char *pattern, int quote) attribute_hidden; @@ -295,7 +288,6 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), bool dirname_modified; glob_t dirs; int retval = 0; - size_t alloca_used = 0; struct char_array dirname; if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0) @@ -972,7 +964,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), status = glob_in_dir (filename, dirs.gl_pathv[i], ((flags | GLOB_APPEND) & ~(GLOB_NOCHECK | GLOB_NOMAGIC)), - errfunc, pglob, alloca_used); + errfunc, pglob); if (status == GLOB_NOMATCH) /* No matches in this directory. Try the next. */ continue; @@ -1079,7 +1071,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int), if (dirname_modified) flags &= ~(GLOB_NOCHECK | GLOB_NOMAGIC); status = glob_in_dir (filename, char_array_str (&dirname), flags, - errfunc, pglob, alloca_used); + errfunc, pglob); if (status != 0) { if (status == GLOB_NOMATCH && flags != orig_flags @@ -1256,8 +1248,7 @@ struct globnames_result The GLOB_APPEND flag is assumed to be set (always appends). */ static int glob_in_dir (const char *pattern, const char *directory, int flags, - int (*errfunc) (const char *, int), - glob_t *pglob, size_t alloca_used) + int (*errfunc) (const char *, int), glob_t *pglob) { void *stream = NULL; struct globnames_array globnames;