diff options
author | Bernd Ahlers <bernd@cvs.openbsd.org> | 2007-04-27 17:58:49 +0000 |
---|---|---|
committer | Bernd Ahlers <bernd@cvs.openbsd.org> | 2007-04-27 17:58:49 +0000 |
commit | 9f2365ad9868613b1cedf19c02c8440a7b570422 (patch) | |
tree | 6ab3954b4a7d0b2bd6a683180022d55b81bef5c3 /app/cwm/xmalloc.c | |
parent | 899e44bee5b681239d5aa9e94bcb6d0a8e8ef7c8 (diff) |
Initial import of cwm-3.
tested by sturm@, ok matthieu@
Diffstat (limited to 'app/cwm/xmalloc.c')
-rw-r--r-- | app/cwm/xmalloc.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/app/cwm/xmalloc.c b/app/cwm/xmalloc.c new file mode 100644 index 000000000..5da60e43f --- /dev/null +++ b/app/cwm/xmalloc.c @@ -0,0 +1,50 @@ +/* + * calmwm - the calm window manager + * + * Copyright (c) 2004 Marius Aamodt Eriksen <marius@monkey.org> + * All rights reserved. + * + * $Id: xmalloc.c,v 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); +} |