Avoid NULL check in free() and malloc_usable_size().

Generalize isalloc() to handle NULL pointers in such a way that the NULL
checking overhead is only paid when introspecting huge allocations (or
NULL).  This allows free() and malloc_usable_size() to no longer check
for NULL.

Submitted by Igor Bukanov and Mike Hommey.
This commit is contained in:
Jason Evans
2012-04-02 14:50:03 -07:00
parent 80b25932ca
commit 96d4120ac0
5 changed files with 37 additions and 22 deletions

View File

@@ -65,7 +65,7 @@ DOCS_HTML := $(DOCS_XML:@objroot@%.xml=@srcroot@%.html)
DOCS_MAN3 := $(DOCS_XML:@objroot@%.xml=@srcroot@%.3)
DOCS := $(DOCS_HTML) $(DOCS_MAN3)
CTESTS := @srcroot@test/aligned_alloc.c @srcroot@test/allocated.c \
@srcroot@test/bitmap.c @srcroot@test/mremap.c \
@srcroot@test/bitmap.c @srcroot@test/mremap.c @srcroot@test/null.c \
@srcroot@test/posix_memalign.c @srcroot@test/thread_arena.c \
@srcroot@test/thread_tcache_enabled.c
ifeq (@enable_experimental@, 1)