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>
diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c
index 97c4395..3f7ff2b 100644
--- a/tests/weston-test-client-helper.c
+++ b/tests/weston-test-client-helper.c
@@ -33,25 +33,15 @@
#include <sys/mman.h>
#include <cairo.h>
-#include "zalloc.h"
#include "shared/os-compatibility.h"
+#include "shared/xalloc.h"
+#include "shared/zalloc.h"
#include "weston-test-client-helper.h"
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) > (b)) ? (b) : (a))
#define clip(x, a, b) min(max(x, a), b)
-void *
-fail_on_null(void *p)
-{
- if (p == NULL) {
- fprintf(stderr, "out of memory\n");
- exit(EXIT_FAILURE);
- }
- return p;
-}
-
-
int
surface_contains(struct surface *surface, int x, int y)
{