]> git.ipfire.org Git - thirdparty/coreutils.git/commit
maint: heap.c: simplify dynamic allocations
authorPádraig Brady <P@draigBrady.com>
Tue, 13 Jul 2010 07:23:52 +0000 (08:23 +0100)
committerPádraig Brady <P@draigBrady.com>
Tue, 13 Jul 2010 15:51:38 +0000 (16:51 +0100)
commitf8574063d566bbf08dbf2dc469f055f13684e525
tree52419002a73e902df5b96ff2a25bf5f8d2725cf8
parent9face836f36c507f01a7d7a33138c5a303e3b1df
maint: heap.c: simplify dynamic allocations

* gl/lib/heap.c (heap_alloc): Use the fact that the xalloc
routines will not return NULL.  Also remove the redundant
temporary variables.
(heap_insert): From Jim Meyering, use x2nrealloc() which
is simpler while handling overflow and increasing the
size more efficiently.  This reallocation is currently
unused by coreutils in any case as it preallocates enough.
gl/lib/heap.c