clients & tests: Unify multiple definitions of x*alloc and related functions
Direct fail_on_null calls now produce output like:
[weston-info] clients/weston-info.c:714: out of memory
xmalloc, et al produce output on failure like:
[weston-info] out of memory (-1)
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
committed by
Pekka Paalanen
parent
4e221f0327
commit
e99e4bf2b9
@@ -61,6 +61,7 @@
|
||||
#include "ivi-layout-export.h"
|
||||
#include "ivi-hmi-controller-server-protocol.h"
|
||||
#include "shared/helpers.h"
|
||||
#include "shared/xalloc.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* structure, globals
|
||||
@@ -150,17 +151,6 @@ controller_module_init(struct weston_compositor *ec,
|
||||
/*****************************************************************************
|
||||
* local functions
|
||||
****************************************************************************/
|
||||
static void *
|
||||
fail_on_null(void *p, size_t size, char *file, int32_t line)
|
||||
{
|
||||
if (size && !p) {
|
||||
weston_log("%s(%d) %zd: out of memory\n", file, line, size);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static void *
|
||||
mem_alloc(size_t size, char *file, int32_t line)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user