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/clients/weston-info.c b/clients/weston-info.c
index e277f88..8ba80c0 100644
--- a/clients/weston-info.c
+++ b/clients/weston-info.c
@@ -34,6 +34,7 @@
 
 #include "shared/helpers.h"
 #include "shared/os-compatibility.h"
+#include "shared/xalloc.h"
 #include "shared/zalloc.h"
 #include "presentation-time-client-protocol.h"
 
@@ -119,35 +120,6 @@
 	bool roundtrip_needed;
 };
 
-static void *
-fail_on_null(void *p)
-{
-	if (p == NULL) {
-		fprintf(stderr, "%s: out of memory\n", program_invocation_short_name);
-		exit(EXIT_FAILURE);
-	}
-
-	return p;
-}
-
-static void *
-xmalloc(size_t s)
-{
-	return fail_on_null(malloc(s));
-}
-
-static void *
-xzalloc(size_t s)
-{
-	return fail_on_null(zalloc(s));
-}
-
-static char *
-xstrdup(const char *s)
-{
-	return fail_on_null(strdup(s));
-}
-
 static void
 print_global_info(void *data)
 {