[PATCH 1/5] clients: Add xcalloc
Bryce W. Harrington
b.harrington at samsung.com
Tue May 6 19:13:11 PDT 2014
Signed-off-by: Bryce Harrington <b.harrington at samsung.com>
---
clients/window.c | 8 ++++++++
clients/window.h | 2 ++
2 files changed, 10 insertions(+)
diff --git a/clients/window.c b/clients/window.c
index f12ce39..cfc1260 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -5647,3 +5647,11 @@ xrealloc(char *p, size_t s)
{
return fail_on_null(realloc(p, s));
}
+
+void *
+xcalloc(size_t n, size_t s)
+{
+ if (n == 0 || s == 0)
+ return NULL;
+ return fail_on_null(calloc(n, s));
+}
diff --git a/clients/window.h b/clients/window.h
index 4e4ccc1..40989ba 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -65,6 +65,8 @@ char *
xstrdup(const char *s);
void *
xrealloc(char *p, size_t s);
+void *
+xcalloc(size_t n, size_t s);
struct display *
display_create(int *argc, char *argv[]);
--
1.7.9.5
More information about the wayland-devel
mailing list