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/screenshot.c b/clients/screenshot.c
index 18b5f88..6e43d5c 100644
--- a/clients/screenshot.c
+++ b/clients/screenshot.c
@@ -38,6 +38,7 @@
 #include <wayland-client.h>
 #include "weston-screenshooter-client-protocol.h"
 #include "shared/os-compatibility.h"
+#include "shared/xalloc.h"
 
 /* The screenshooter is a good example of a custom object exposed by
  * the compositor and serves as a test bed for implementing client
@@ -79,21 +80,6 @@
 	}
 }
 
-static void *
-xmalloc(size_t size)
-{
-	void *p;
-
-	p = malloc(size);
-	if (p == NULL) {
-		fprintf(stderr, "%s: out of memory\n",
-			program_invocation_short_name);
-		exit(EXIT_FAILURE);
-	}
-
-	return p;
-}
-
 static void
 display_handle_mode(void *data,
 		    struct wl_output *wl_output,