bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

regex and alloca


From: Bruno Haible
Subject: regex and alloca
Date: Mon, 24 May 2010 12:24:08 +0200
User-agent: KMail/1.9.9

What are the requirements of the 'regex' module on platforms that don't have
alloca()?

All uses of alloca are inside regexec.c and are guarded by a call to
if (__libc_use_alloca (n)), which expands to if (0).

This means:
  1) The library does not really need to provide an alloca function.
  2) But it needs a stub, for when compiling without optimization, to avoid
     a link error.

I'm therefore applying this:


2010-05-24  Bruno Haible  <address@hidden>

        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).

--- lib/regex_internal.h.orig   Mon May 24 12:16:22 2010
+++ lib/regex_internal.h        Mon May 24 12:15:28 2010
@@ -467,6 +467,8 @@
 # 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
 
--- modules/regex.orig  Mon May 24 12:16:22 2010
+++ modules/regex       Mon May 24 12:13:43 2010
@@ -12,7 +12,7 @@
 m4/mbstate_t.m4
 
 Depends-on:
-alloca
+alloca-opt
 btowc
 extensions
 gettext-h



reply via email to

[Prev in Thread] Current Thread [Next in Thread]