[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);
}
- [PATCH 1/2] Add nmalloc, NMALLOC et al., Ondřej Bílka, 2013/11/03
- [SPATCH 2/2] Rewrite malloc/malloca to one avoiding overflows., Ondřej Bílka, 2013/11/03
- Re: [PATCH 1/2] Add nmalloc, NMALLOC et al., Paul Eggert, 2013/11/03
- Re: [PATCH 1/2] Add nmalloc, NMALLOC et al.,
Ondřej Bílka <=
- Re: [PATCH 1/2] Add nmalloc, NMALLOC et al., Richard W.M. Jones, 2013/11/06