[v2,5/5] regex: stop using alloca

Message ID 20210113165826.1014708-5-adhemerval.zanella@linaro.org
State Committed
Commit 36c604ed36b9989a38dd4e323c404d89fd173009
Headers
Series [1/5] misc: Sync cdefs.h with gnulib |

Commit Message

Adhemerval Zanella Jan. 13, 2021, 4:58 p.m. UTC
  It syncs with gnulib version 87ed1f9c4.  No functional changes is
expected.

Checked on x86_64-linux-gnu.
---
 posix/regex_internal.h | 19 -------------------
 1 file changed, 19 deletions(-)
  

Comments

Adhemerval Zanella Feb. 9, 2021, 7:12 p.m. UTC | #1
I will commit this shortly if no one opposes it.

On 13/01/2021 13:58, Adhemerval Zanella wrote:
> It syncs with gnulib version 87ed1f9c4.  No functional changes is
> expected.
> 
> Checked on x86_64-linux-gnu.
> ---
>  posix/regex_internal.h | 19 -------------------
>  1 file changed, 19 deletions(-)
> 
> diff --git a/posix/regex_internal.h b/posix/regex_internal.h
> index e31ac92674..641b27e2b1 100644
> --- a/posix/regex_internal.h
> +++ b/posix/regex_internal.h
> @@ -444,25 +444,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
>
  

Patch

diff --git a/posix/regex_internal.h b/posix/regex_internal.h
index e31ac92674..641b27e2b1 100644
--- a/posix/regex_internal.h
+++ b/posix/regex_internal.h
@@ -444,25 +444,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