This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: malloc.c defining an assert macro
On Mon, Jan 29, 2018 at 11:24 AM, Samuel Thibault
<samuel.thibault@gnu.org> wrote:
> Joseph Myers, on lun. 29 janv. 2018 16:07:31 +0000, wrote:
>> First, is there any reason malloc.c needs its own assert macro?
>
> Malloc's assert avoids using malloc() whenever possible :)
That seems like a desirable quality for assert in general! Perhaps
the malloc version of assert should replace what's currently in
assert/assert.c. Or, having skimmed both implementations, here's a
middle way that preserves the __abort_msg functionality: instead of
using asprintf and then copying to the special page, allocate the
special page up front and write to it directly, and truncate it at
PAGE_SIZE. Nobody wants a >4KB assertion message anyway.
zw