mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Initial revision
This commit is contained in:
50
xmalloc.c
Normal file
50
xmalloc.c
Normal file
@@ -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);
|
||||
}
|
Reference in New Issue
Block a user