]> Savannah Git Hosting - gnulib.git/commitdiff
regex: stop using alloca
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 Jan 2021 01:17:32 +0000 (17:17 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 Jan 2021 01:17:57 +0000 (17:17 -0800)
* lib/regex_internal.h: Do not include <alloca.h> 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.

ChangeLog
lib/regex_internal.h
modules/regex

index 708a266b03a320c752bb1e97389c5e3aa4eb2d2c..a2787f59ad8b99127a7239936bfee24821ff9279 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2021-01-08  Paul Eggert  <eggert@cs.ucla.edu>
 
+       regex: stop using alloca
+       * lib/regex_internal.h: Do not include <alloca.h> 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
index 5d4d5fe2b35e0cf49bf88ae9dce05d3a1495ede6..b4f91d9ec7158500c6d4696938e493333f623385 100644 (file)
@@ -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 <alloca.h>
-#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
index 39297dfe3cd06017061b416e4ea84f3d5c85adda..20cbe375ad67ed02fe202ba9c095861fd5e19930 100644 (file)
@@ -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]