[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] loader: don't call realloc(O) when no symbols a
From: |
malc |
Subject: |
Re: [Qemu-devel] [PATCH] loader: don't call realloc(O) when no symbols are present |
Date: |
Tue, 29 Dec 2009 23:17:59 +0300 (MSK) |
On Tue, 29 Dec 2009, Jamie Lokier wrote:
> malc wrote:
> > On Mon, 28 Dec 2009, Jamie Lokier wrote:
> >
> > > Aurelien Jarno wrote:
> > > > This fixes the loading of a stripped kernel with zero malloc disabled.
> > >
> > > *Raises an eyebrow*
> > >
> > > Even though there's different perspectives over whether qemu_malloc(0)
> > > should be allowed, inherited from ambiguity over malloc(0),
> > > realloc(p,0) has always had a standard, well-defined meaning.
> >
> > No.
> > http://groups.google.com/group/comp.std.c/browse_thread/thread/4e9af8847613d71f/6f75ad22e0768a0b?q=realloc++group:comp.std.c#6f75ad22e0768a0b
>
> Wow, thanks for that. It's a real surprise. Looks like C99's own
> rationale is not consistent with itself on the subject, and differs
> from C90 where the "standard, well-defined meaning" I referred to was
> defined.
Yep.
>
> See also http://c-faq.com/malloc/reallocnull.html which says "and the
> related realloc(..., 0), which frees" and has references at the end.
> See, it's not just me :-)
Nope not just you, even glibc still uses C90 behaviour.
> So thanks for setting me straight. One thing we can all agree on now
> is that it's best not to call malloc(0) or realloc(p,0) at all :-)
Indeed.
--
mailto:address@hidden