bug-gnulib
[Top][All Lists]
Advanced

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

Re: what does regex depend on sys_wait?


From: Bruno Haible
Subject: Re: what does regex depend on sys_wait?
Date: Tue, 28 Sep 2010 02:17:25 +0200
User-agent: KMail/1.9.9

Eric Blake wrote:
> Because POSIX requires <stdlib.h> to provide WEXITSTATUS, among others, 
> but some systems don't do this by default.  Therefore, the stdlib module 
> depends on sys_wait.

This explains why 'stdlib' depends on 'sys_wait'.

And why does 'regex' depend on 'stdlib'? 'regex' does not encounter any of the
portability problems that are listed in
<http://www.gnu.org/software/gnulib/manual/html_node/stdlib_002eh.html>.
But there is a dependency chain
  regex --> malloc-gnu --> malloc-posix --> stdlib
In other words, the regex code assumes a glibc compatible malloc, and
this rpl_malloc() replacement needs to be defined in gnulib's substitute
for <stdlib.h>.

gnulib does not, among the modules that it provides, make a distinction
between "stdlib.h which just defines malloc" and "stdlib.h which is
completely POSIX". Providing more fine-grained modules would increase
the size the meta-information even more. For my feeling, the size of
the meta-information (module descriptions) is already larger than most
people like it to be.

So, in order to cut this dependency, it would be necessary to change
regcomp.c and regexec.c so that its malloc calls
  1. protect the argument so it is never 0,
  2. set errno = ENOMEM in case of failure.
Since this is redundant on glibc platforms, Jim has been opposed to this
change (as far as I recall).

Bruno



reply via email to

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