This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Better messages for discarde section


Nick Clifton <nickc@redhat.com> writes:

> Hi H.J.
> 
> >> asprintf() returns 0 if it failed to allocate the memory, not -1.
> 
> > Linux's asprintf returns -1 on error.
> 
> Really ?  The one in libiberty returns 0.  Oh well.

We should probably change the one in libiberty anyhow.  They are
documented to return the same value that sprintf returns, but sprintf
will return 0 legitimately when called with an empty string.  Since 0
is a valid return value, we should use something else for an error
return value.  -1 is the obvious choice, particularly since that's
what glibc uses (and has used since 1991).

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]