Movatterモバイル変換
[0]ホーム
This is the mail archive of thelibc-alpha@sourceware.orgmailing list for theglibc project.
[PATCH 13/18] posix: Remove all alloca usage in glob
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-alpha at sourceware dot org
- Date: Fri, 11 Aug 2017 11:50:39 -0300
- Subject: [PATCH 13/18] posix: Remove all alloca usage in glob
- Authentication-results: sourceware.org; auth=none
- References: <1502463044-4042-1-git-send-email-adhemerval.zanella@linaro.org>
With alloca usage removal from glob this patch wraps it up by removingall 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(-)diff --git a/posix/glob.c b/posix/glob.cindex f40ee6d..67196fd 100644--- a/posix/glob.c+++ b/posix/glob.c@@ -59,7 +59,6 @@ #include <dirent.h> #include <stdlib.h> #include <string.h>-#include <alloca.h> #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;-- 2.7.4
[8]ページ先頭