From 055eec93ac495df814cc5585fd55712a6cac06c4 Mon Sep 17 00:00:00 2001 From: bernd Date: Fri, 27 Apr 2007 17:58:48 +0000 Subject: Initial import of cwm-3. tested by sturm@, ok matthieu@ --- xmalloc.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 xmalloc.c (limited to 'xmalloc.c') diff --git a/xmalloc.c b/xmalloc.c new file mode 100644 index 0000000..5b4efdf --- /dev/null +++ b/xmalloc.c @@ -0,0 +1,50 @@ +/* + * calmwm - the calm window manager + * + * Copyright (c) 2004 Marius Aamodt Eriksen + * All rights reserved. + * + * $Id: xmalloc.c,v 1.1.1.1 2007/04/27 17:58:48 bernd Exp $ + */ + +#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); +} -- cgit v1.2.3-2-gb3c3