From 5a4965c01c8b2aca03846238596c0b9f0ed3ce85 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Mon, 24 May 2010 12:23:03 +0200
Subject: [PATCH] regex: Don't require alloca.

---
 ChangeLog            | 7 +++++++
 lib/regex_internal.h | 2 ++
 modules/regex        | 2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 39a7215b48..1b37e94cdb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-05-24  Bruno Haible  <bruno@clisp.org>
+
+	regex: Don't require alloca.
+	* modules/regex (Depends-on): Remove alloca. Add alloca-opt.
+	* lib/regex_internal.h (alloca): Ensure it's defined even if we call it
+	only inside if (0).
+
 2010-05-23  Jim Meyering  <meyering@redhat.com>
 
 	test-renameat.c: include <sys/stat.h>
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index e1b4c61b36..dc94e2cbcb 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -467,6 +467,8 @@ static unsigned int re_string_context_at (const re_string_t *input, Idx idx,
 # 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
 
diff --git a/modules/regex b/modules/regex
index f51640621c..36ad446390 100644
--- a/modules/regex
+++ b/modules/regex
@@ -12,7 +12,7 @@ m4/regex.m4
 m4/mbstate_t.m4
 
 Depends-on:
-alloca
+alloca-opt
 btowc
 extensions
 gettext-h
-- 
2.30.2