Re: 3 small patches

2011-03-24 Thread Bruno Haible
Reuben Thomas wrote: > 1. Say what posix-modules does (just adds an extra comment) Applied. Thanks for reminding us. Bruno -- In memoriam Óscar Romero

3 small patches

2011-03-24 Thread Reuben Thomas
Two old ones I noticed I had hanging around; one new: 1. Say what posix-modules does (just adds an extra comment) 2. Make valgrind stricter (as discussed recently) 3. Add missing tag name to git tag command (also as discussed recently) Please do accept or reject; none is vital enough to me that

Re: proper realloc(p,0) behavior?

2011-03-24 Thread Bruno Haible
> Situation per platform: > >    glibc   (b) >    FreeBSD (a), (c) if OOM >    OpenBSD (a), (c) if OOM >    AIX     (b) >    HP-UX   (b) >    IRIX    (a), (c) if OOM >    OSF/1   (b) >    Solaris (b) Cygwin (a), (c) if OOM mingw (b) Bruno -- In memoriam Óscar Romero

Re: proper realloc(p,0) behavior?

2011-03-24 Thread Bruno Haible
Eric Blake asked: > How should gnulib react? And are there any existing GNU programs that > would break ...? There are three possible behaviours of realloc(p,0): (a) returns non-NULL pointer. (b) returns NULL and frees p. (c) fails and returns NULL. Situation per platform: glibc (b)

Re: proper realloc(p,0) behavior?

2011-03-24 Thread Bruno Haible
Eric Blake wrote: > C99 requires realloc(p,0) to either successfully allocate a 0-sized > array (just like malloc(0)) or to return NULL and leave p unchanged. > > glibc treats realloc(p,0) like free(p) (as permitted by C89), and using > C99 compliant code would thus result in a double-free bug. I

Re: proper realloc(p,0) behavior?

2011-03-24 Thread Paul Eggert
On 03/24/2011 12:47 PM, Eric Blake wrote: > No argument by me if we enforce saner semantics to xrealloc. No matter what we do it's problematic, but it's a bit saner if xrealloc's callers can assume GNU behavior, so I pushed this: xmalloc: Do not leak if underlying realloc is C99 compatible. * lib

Re: A bug in findutils?

2011-03-24 Thread Eric Blake
On 03/24/2011 02:05 AM, Cao, Da-Shi (EB-Presales-ZTE/HW-GZ) wrote: > The compilation of findutils 4.4.2 failed when I did a cross compile on i386 > to x86_64. The error is that type "wint_t" didn't get defined so the > compilation of mbchar.c in gnulib/lib failed. > The type "wint_t" is defined i

Re: proper realloc(p,0) behavior?

2011-03-24 Thread Eric Blake
On 03/24/2011 01:02 PM, Jim Meyering wrote: >> It should be fairly easy to write code that is portable >> to both C89 and C99 and does not leak, by using free (p) rather >> than realloc (p, 0). For example, we could apply the following >> patch to xmalloc.c: We can do whatever we want with xreall

[PATCH] realloc: document portability problem

2011-03-24 Thread Eric Blake
* doc/posix-functions/realloc.texi (realloc): Mention pitfalls of passing 0 size to realloc. Signed-off-by: Eric Blake --- > The issue is well worth documenting in the gnulib manual. Agreed. I pushed this. ChangeLog|6 ++ doc/posix-functions/realloc.texi | 1

Re: proper realloc(p,0) behavior?

2011-03-24 Thread Jim Meyering
Paul Eggert wrote: > On 03/24/2011 10:17 AM, Eric Blake wrote: >> How should gnulib react? And are there any existing GNU programs that >> would break if C99 realloc semantics were enforced? > > My kneejerk reaction is that > programs should be written so as to be portable to > both C89 (which GNU

Re: proper realloc(p,0) behavior?

2011-03-24 Thread Paul Eggert
On 03/24/2011 10:17 AM, Eric Blake wrote: > How should gnulib react? And are there any existing GNU programs that > would break if C99 realloc semantics were enforced? My kneejerk reaction is that programs should be written so as to be portable to both C89 (which GNU implements) and C99 realloc.

Re: error: expected ')' before 'int'

2011-03-24 Thread Sam Steingold
> * Sam Steingold [2011-03-24 10:45:47 -0400]: > > I am trying to update gnulib in clisp and clisp no longer compiles: > > In file included from ../../src/gllib/close-hook.c:23: > ./stdlib.h:611: error: expected ')' before 'int' > ./stdlib.h:729: error: expected ')' before 'int' > In file included

proper realloc(p,0) behavior?

2011-03-24 Thread Eric Blake
C99 requires realloc(p,0) to either successfully allocate a 0-sized array (just like malloc(0)) or to return NULL and leave p unchanged. glibc treats realloc(p,0) like free(p) (as permitted by C89), and using C99 compliant code would thus result in a double-free bug. POSIX 2008 is ambiguous - it

error: expected ')' before 'int'

2011-03-24 Thread Sam Steingold
Hi, I am trying to update gnulib in clisp and clisp no longer compiles: In file included from ../../src/gllib/close-hook.c:23: ./stdlib.h:611: error: expected ')' before 'int' ./stdlib.h:729: error: expected ')' before 'int' In file included from ../../src/gllib/close-hook.c:24: ./unistd.h:290: er