screenshooter: Only link to $(CLIENT_LIBS) not libtoytoolkit.la
This application doesn't use toytoolkit, so don't link to it. We have to
add a copy of xmalloc, to link without toytoolkit.
diff --git a/clients/screenshot.c b/clients/screenshot.c
index d58d8b1..1c0f203 100644
--- a/clients/screenshot.c
+++ b/clients/screenshot.c
@@ -20,7 +20,10 @@
* OF THIS SOFTWARE.
*/
+#include "config.h"
+
#include <stdint.h>
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -75,6 +78,21 @@
}
}
+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,
@@ -185,7 +203,7 @@
buffer_stride = width * 4;
- data = malloc(buffer_stride * height);
+ data = xmalloc(buffer_stride * height);
if (!data)
return;