1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-11-05 03:47:17 -05:00
uemacs/wrapper.c
Thiago Farina 6e4aec520e uemacs: Add xmalloc as a wrapper function for malloc.
xmalloc checks the returned pointer and dies if it failed to allocate
the memory.

Use this new function in window.c.
More places will be converted to use xmalloc latter.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-12-16 08:33:10 -08:00

23 lines
313 B
C

#include "usage.h"
#include <stdlib.h>
/* Function copyright: git */
int xmkstemp(char *template)
{
int fd;
fd = mkstemp(template);
if (fd < 0)
die("Unable to create temporary file");
return fd;
}
void *xmalloc(size_t size)
{
void *ret = malloc(size);
if (!ret)
die("Out of memory");
return ret;
}