]> diplodocus.org Git - nmh/blob - sbr/utils.c
bc171772c8a9b91b45941aafb370cbcbfa8b76e0
[nmh] / sbr / utils.c
1
2 /*
3 * utils.c -- various utility routines
4 *
5 * $Id$
6 *
7 * This code is Copyright (c) 2006, by the authors of nmh. See the
8 * COPYRIGHT file in the root directory of the nmh distribution for
9 * complete copyright information.
10 */
11
12 #include <h/nmh.h>
13 #include <h/utils.h>
14 #include <stdlib.h>
15
16 void *
17 mh_xmalloc(size_t size)
18 {
19 void *memory;
20
21 if (size == 0)
22 adios(NULL, "Tried to malloc 0 bytes");
23
24 memory = malloc(size);
25 if (!memory)
26 adios(NULL, "Malloc failed");
27
28 return memory;
29 }