bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH 1/2] Add nmalloc, NMALLOC et al.


From: Ondřej Bílka
Subject: Re: [PATCH 1/2] Add nmalloc, NMALLOC et al.
Date: Sun, 3 Nov 2013 21:13:33 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

On Sun, Nov 03, 2013 at 12:04:36PM -0800, Paul Eggert wrote:
> Ondřej Bílka wrote:
> > +XALLOC_INLINE void *
> > +nmalloc (size_t n, size_t s)
> > +{
> > +  if (xalloc_oversized (n, s))
> > +    xalloc_die ();
> > +  return xmalloc (n * s);
> > +}
> 
> This is the same as the existing xnmalloc, so why bother with a new name?
> Similarly for the other changes.

I accidentally inlined wrong version. As idea is to handle overflow by
oom logic these should be:

nmalloc (size_t n, size_t s)
{
  if (xalloc_oversized (n, s))
    NULL;
  return malloc (n * s);
}




reply via email to

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