Mercurial > ~dholland > hg > ag > index.cgi
comparison help2html/must.c @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 #include <stdlib.h> | |
2 #include <err.h> | |
3 #include "must.h" | |
4 | |
5 void *must_malloc(size_t len) { | |
6 void *x = malloc(len); | |
7 if (!x) { | |
8 errx(1, "Out of memory"); | |
9 } | |
10 return x; | |
11 } | |
12 | |
13 void *must_realloc(void *ptr, size_t len) { | |
14 void *x = realloc(ptr, len); | |
15 if (!x) { | |
16 errx(1, "Out of memory"); | |
17 } | |
18 return x; | |
19 } |