Be consistent in handling memory allocation failures by always aborting execution. Previously, some call sites for malloc/calloc/realloc tried to handle allocation failures, but some others did not. Given that WebKit's FastMalloc will itself abort on allocation failures, doing the same in libwpe keeps behaviour consistent.
A new alloc-private.h header redefines the libc functions with wpe_ prefixes, which perform checks after invoking the libc versions, and use a common wpe_alloc_fail(). The actual implementation is done through macros in order to pass along __FILE__/__LINE__ to a set of inline functions defined directly in the header, in order to help out debug failures. As a bonus, GCC's poison pragma (supported by Clang, too) prevents accidental usage of the libc allocation functions.
As a side effect, simplify the call sites which attempted to handle failures, which now can assume that allocations never fail.
Be consistent in handling memory allocation failures by always aborting execution. Previously, some call sites for
malloc
/calloc
/realloc
tried to handle allocation failures, but some others did not. Given that WebKit's FastMalloc will itself abort on allocation failures, doing the same in libwpe keeps behaviour consistent.A new
alloc-private.h
header redefines the libc functions withwpe_
prefixes, which perform checks after invoking the libc versions, and use a commonwpe_alloc_fail()
. The actual implementation is done through macros in order to pass along__FILE__
/__LINE__
to a set of inline functions defined directly in the header, in order to help out debug failures. As a bonus, GCC'spoison
pragma (supported by Clang, too) prevents accidental usage of the libc allocation functions.As a side effect, simplify the call sites which attempted to handle failures, which now can assume that allocations never fail.
Fixes #112