Re: xmalloc.c's xcalloc performs unnecessary test for N*S overflow

2005-06-22 Thread Paul Eggert
I installed the following (slightly different) patch for that problem, into gnulib. It's tested with GNU tar. 2005-06-22 Paul Eggert <[EMAIL PROTECTED]> * xmalloc.c (HAVE_GNU_CALLOC): New constant. (xcalloc): Use it to avoid needless tests. Problem reported by Jim Meyer

Re: xmalloc.c's xcalloc performs unnecessary test for N*S overflow

2005-06-17 Thread Jim Meyering
Paul Eggert <[EMAIL PROTECTED]> wrote: ... > How about the following (also untested) patch? > > 2005-06-17 Paul Eggert <[EMAIL PROTECTED]> > > * xmalloc (HAVE_GNU_CALLOC): New macro. > (xcalloc): Omit needless tests if ! HAVE_GNU_CALLOC. Looks fine to me. Thanks! __

Re: xmalloc.c's xcalloc performs unnecessary test for N*S overflow

2005-06-17 Thread Paul Eggert
Jim Meyering <[EMAIL PROTECTED]> writes: > This makes me think it'd be worthwhile to support a new section in > the modules file listing `Recommended' modules. Yes, that would be nice. It's been suggested before but nobody has had the time yet to do it. gnulib-tool might bring in recommended mo

Re: xmalloc.c's xcalloc performs unnecessary test for N*S overflow

2005-06-17 Thread Jim Meyering
Paul Eggert <[EMAIL PROTECTED]> wrote: > Jim Meyering <[EMAIL PROTECTED]> writes: > >> As it stands, if I use both of the xalloc and calloc modules, >> calling xcalloc ends up performing the overflow check twice, >> first in xcalloc itself (above), and then again in calloc. > > Also, xcalloc conta

Re: xmalloc.c's xcalloc performs unnecessary test for N*S overflow

2005-06-16 Thread Paul Eggert
Jim Meyering <[EMAIL PROTECTED]> writes: > As it stands, if I use both of the xalloc and calloc modules, > calling xcalloc ends up performing the overflow check twice, > first in xcalloc itself (above), and then again in calloc. Also, xcalloc contains a test n != 0 that isn't needed when rpl_call

xmalloc.c's xcalloc performs unnecessary test for N*S overflow

2005-06-16 Thread Jim Meyering
Currently, the xalloc module doesn't depend on any other. I think it should depend at least on the calloc module. If it did so, the test for overflow /* Test for overflow, since some calloc implementations don't have proper overflow checks. */ if (xalloc_oversized (n, s) || (! (p = callo