From patchwork Fri Aug 11 14:50:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 109893 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp976924obb; Fri, 11 Aug 2017 07:53:21 -0700 (PDT) X-Received: by 10.84.236.5 with SMTP id q5mr18089396plk.233.1502463200825; Fri, 11 Aug 2017 07:53:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502463200; cv=none; d=google.com; s=arc-20160816; b=j2xLywjMaaDcnrJJHk9IDS8ZuuqPr3+SmfzhCY3+WpBPJXHBm8b3cxIO+xchmWZnPq c2CGlnc2vgA4IdKrwA/K2Sdui/+UGwSMjxhdiE9Ph0gt45P5Zp/yKoCpYE8kceGPjefy 56P9DXmYOntGnuW0t7jTBvJqrlCKTtpmcBOWXdfzSm/A/uFUneb7a/RKLI6jC1R1UkKk 0coqv4NLbvGHtSB+Yahk8lPXLxdaWTfh8ILZAMtVJwiy/pPkEG9TBlT5x9wviICnN3jq sOwfRCc5D0Ku7TxHKhL+oUuEOVscCXJhlDAoxS+Ku18OB/kFJS+aoKNrGGe5TeC9c1Cp fFGg== 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=dt21c5CGf3bNqjWbUByClu6rKWzsNKlRGgt0P4ZNXP8=; b=isX8DGeJGlQIatM76foreB761L68ySYM31e1BWznKmByRK8Rnb7TjeRXslzcc9SH7K vzK/WOtheIE29ZAKZN7RAA6K5Ltw1ZEvGTeGfvmZle4C56r3j40T1rpESXZJKj3NKU5E 63Fix468rwM0E2mZYkTVX4fVE+Mfxkb8lW/Jc7i2LAIETdJ+XFKpjWxh7XVQNyESNOfm g4adJqeJbPp1xwDX5zu0DWOKZeR4TWbXneMPlCxV36fIm9eCNpkd04TblN/H2rF2slLl HvW+i8Deu4BMBOLJ1TKWdec6Pug3oF6rG8Gmie1BD7JjAaojoDBpNvqQtsGczuwcc1Rw RTwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=tvDN0Jlf; spf=pass (google.com: domain of libc-alpha-return-83035-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-83035-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 l33si660407pld.75.2017.08.11.07.53.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Aug 2017 07:53:20 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-83035-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 header.s=default header.b=tvDN0Jlf; spf=pass (google.com: domain of libc-alpha-return-83035-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-83035-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=oOwKbv5No3DIO+Aq7a7swE1jF084Zaq MvwFAcMwpZged1QypwyB97JGuf0XfaDjotJTRGHQZtquez4XbL1KSIZlANW8eKqB sTuI0hFGWqDgzdIhncqWbkfrFCRLC2tkgk1tTvFqJ0J7bmW1dh0Ujl06abWr3Xse oPsI6/o1Vgug= 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=9ZshLjwvKS+4JlGTSB/gge1K2tw=; b=tvDN0 Jlfq8ZYfRFT+LkDn3KW7jdxpl+CgkzTu/yFR7W3g5r/lSobaFeF7M8e/UTVhXyGj meZWBzErbcgcO6fTXk3gJa2nPPc+HSZUU0uDqNVKeIuaWTb19Z5gG5Si3CUFsmXk 60JuXkZtbj9IJiREMehXDU2+R2L58VZt4ZrhX0= Received: (qmail 79189 invoked by alias); 11 Aug 2017 14:51:16 -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 78261 invoked by uid 89); 11 Aug 2017 14:51:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2615 X-HELO: mail-qk0-f173.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=dt21c5CGf3bNqjWbUByClu6rKWzsNKlRGgt0P4ZNXP8=; b=BVWDFWT+OljmHSso14bjjOTGZTgD9FQNaRV8zHsrv2QJ6C3aHavg4nHFlHngedtGOw f5S18B3kVFcs2ku2VbUDqnwaMQKNgW19+u1LheJWwrOPfdiDd6EXQuknPJOht7NQ0uVg ISq0NgI28L0tNCFmc7smRH05of/G1Lv5yg9EF+Td9z8bvWqSHqNPRg4c1ygdErB9GueS OeO/hscNp8343rJ50wF2pAF/XM5Gjtt9Sn1PJS+0O+te6FVlswWqWEdP+6nRa/ayMcTj pPMPySs3lERPtW+hqOY59qbmn2CKkxaLL5plKGyQhOzv7WRj3wu/JSw32gjCDhZsyAip 2wxA== X-Gm-Message-State: AHYfb5hxd6yGb2O6zz8T7FoulNNbtt7Zz6PhdIV+OEXik87Y6EYwPKJf OIO4nIfK3pxZcCEsdHmHfw== X-Received: by 10.55.16.161 with SMTP id 33mr20386638qkq.312.1502463068219; Fri, 11 Aug 2017 07:51:08 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 13/18] posix: Remove all alloca usage in glob Date: Fri, 11 Aug 2017 11:50:39 -0300 Message-Id: <1502463044-4042-14-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1502463044-4042-1-git-send-email-adhemerval.zanella@linaro.org> References: <1502463044-4042-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 f40ee6d..67196fd 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -59,7 +59,6 @@ #include #include #include -#include #ifdef _LIBC # undef strdup @@ -230,17 +229,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; @@ -296,7 +289,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) @@ -974,7 +966,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; @@ -1081,7 +1073,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 @@ -1258,8 +1250,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;