[PATCH 02/17] Regex: Fix alloca ifdefs and usage.

Paul Eggert eggert@cs.ucla.edu
Tue Dec 19 22:14:00 GMT 2017


For this one, the patch to regcomp.c is in Gnulib and looks good. 
However, the patch to regex_internal.h has problems compared to a 
similar patch that is already in Gnullib. That is, instead of this:
> -#include <alloca.h>
> -
>   #ifndef _LIBC
>   # if HAVE_ALLOCA
> +#  include <alloca.h>

I suggest this replacing the #include line with this:

#if defined _LIBC || HAVE_ALLOCA
# include <alloca.h>
#endif

That way, we shouldn't need to have ugly changes like this one:

> +#ifdef HAVE_ALLOCA
>     if (__libc_use_alloca (nmatch * sizeof (regmatch_t)))
>       prev_idx_match = (regmatch_t *) alloca (nmatch * sizeof (regmatch_t));
>     else
> +#endif
which will keep things simpler.



More information about the Libc-alpha mailing list