This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] [BZ 20628] make mallinfo saturating
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: DJ Delorie <dj at redhat dot com>, libc-alpha at sourceware dot org
- Date: Tue, 27 Sep 2016 12:07:37 -0700
- Subject: Re: [PATCH] [BZ 20628] make mallinfo saturating
- Authentication-results: sourceware.org; auth=none
- References: <xny42drz8h.fsf@greed.delorie.com>
It would be more backward-compatible to represent minor overflows as
negative numbers that are equivalent to the correct answers modulo
(UINT_MAX + 1). That way, callers can continue to retrieve the correct
values by casting int to unsigned. The code can use -1 to represent a
value greater than UINT_MAX. This all should be doable just as
efficiently as the proposed patch.