From: Paul Eggert Date: Sat, 9 Jan 2021 01:17:32 +0000 (-0800) Subject: regex: stop using alloca X-Git-Tag: v1.0~3177 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=87ed1f9c4bc4ae9e98e1293465a5b3a929b9c3f9;p=gnulib.git regex: stop using alloca * lib/regex_internal.h: Do not include or define __libc_use_alloca or alloca. Patch written by Adhemerval Zanella: https://sourceware.org/pipermail/libc-alpha/2021-January/121374.html * modules/regex (Depends-on): Remove alloca-opt. --- diff --git a/ChangeLog b/ChangeLog index 708a266b03..a2787f59ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2021-01-08 Paul Eggert + regex: stop using alloca + * lib/regex_internal.h: Do not include or define + __libc_use_alloca or alloca. Patch written by Adhemerval Zanella: + https://sourceware.org/pipermail/libc-alpha/2021-January/121374.html + * modules/regex (Depends-on): Remove alloca-opt. + regexec: remove alloca usage in build_trtable Prompted by this different change proposed by Adhemerval Zanella: https://sourceware.org/pipermail/libc-alpha/2021-January/121373.html diff --git a/lib/regex_internal.h b/lib/regex_internal.h index 5d4d5fe2b3..b4f91d9ec7 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -445,25 +445,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 diff --git a/modules/regex b/modules/regex index 39297dfe3c..20cbe375ad 100644 --- a/modules/regex +++ b/modules/regex @@ -16,7 +16,6 @@ Depends-on: c99 extensions ssize_t -alloca-opt [test $ac_use_included_regex = yes] btowc [test $ac_use_included_regex = yes] builtin-expect [test $ac_use_included_regex = yes] dynarray [test $ac_use_included_regex = yes]