summary refs log tree commit diff
path: root/xmalloc.c
diff options
context:
space:
mode:
authorbernd <bernd>2007-04-27 17:58:48 +0000
committerbernd <bernd>2007-04-27 17:58:48 +0000
commit3d12c94f42f91e957fa8a68efcd3b0387791e6cf (patch)
tree8bd9782a01bbd59ee27201e29b30d058b15445db /xmalloc.c
downloadcwm-3d12c94f42f91e957fa8a68efcd3b0387791e6cf.tar.gz
cwm-3d12c94f42f91e957fa8a68efcd3b0387791e6cf.tar.xz
cwm-3d12c94f42f91e957fa8a68efcd3b0387791e6cf.zip
Initial revision
Diffstat (limited to 'xmalloc.c')
-rw-r--r--xmalloc.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/xmalloc.c b/xmalloc.c
new file mode 100644
index 0000000..4e0fcb3
--- /dev/null
+++ b/xmalloc.c
@@ -0,0 +1,50 @@
+/*
+ * calmwm - the calm window manager
+ *
+ * Copyright (c) 2004 Marius Aamodt Eriksen <marius@monkey.org>
+ * All rights reserved.
+ *
+ * $Id$
+ */
+
+#include "headers.h"
+#include "calmwm.h"
+
+void *
+xmalloc(size_t siz)
+{
+	void *p;
+
+	if ((p = malloc(siz)) == NULL)
+		err(1, "malloc");
+
+	return (p);
+}
+
+void *
+xcalloc(size_t siz)
+{
+	void *p;
+
+	if ((p = calloc(1, siz)) == NULL)
+		err(1, "calloc");
+
+	return (p);
+}
+
+void
+xfree(void *p)
+{
+	free(p);
+}
+
+char *
+xstrdup(const char *str)
+{
+	char *p;
+
+	if ((p = strdup(str)) == NULL)
+		err(1, "strdup");
+
+	return (p);
+}