bug-gnulib
[Top][All Lists]
Advanced

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

Re: getline() behaviour change


From: Jim Meyering
Subject: Re: getline() behaviour change
Date: Fri, 24 Aug 2007 17:13:08 +0200

Eric Blake <address@hidden> wrote:
> According to Ben Pfaff on 8/22/2007 5:19 PM:
>> Bruno Haible <address@hidden> writes:
>>
>>> Jim Meyering wrote:
>>>> A *lot* of code expects malloc and realloc to set errno when they fail.
>>> Such code is not portable to plain ISO C 99 systems.
>>
>> We could extend gnulib's existing malloc/realloc wrappers to
>> ensure that malloc/realloc set errno when they fail, if it is
>> worthwhile to do so.
>
> I would somewhat like this idea - it is much nicer assuming that malloc
> reliably sets errno to ENOMEM on failure than having to patch all callers
> of malloc to do the same.

Yes.  This is a fundamental goal of gnulib:
If there is some portability problem, don't penalize *all* software and
all systems.  Instead, keep the client software clean, and penalize
only the systems that have the problem.  The losing system (mingw,
in this case) can endure a little overhead in malloc/realloc wrappers.
That's far better than polluting all malloc-using application code with
obscure, seemingly-unnecessary code to set errno upon malloc failure.




reply via email to

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