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:
Bryce Harrington
2016-03-16 14:15:18 -07:00
committed by Pekka Paalanen
parent 4e221f0327
commit e99e4bf2b9
23 changed files with 150 additions and 159 deletions
+1 -11
View File
@@ -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)
{