Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
#include "../shared/os-compatibility.h"
#include "weston-test-client-helper.h"
+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)
{
void *data;
};
+void *
+fail_on_null(void *p);
+
static inline void *
-xzalloc(size_t size)
+xzalloc(size_t s)
{
- void *p;
-
- p = calloc(1, size);
- assert(p);
+ return fail_on_null(calloc(1, s));
+}
- return p;
+static inline void *
+xmalloc(size_t s)
+{
+ return fail_on_null(malloc(s));
}
struct client *