comparison helpgen/utils.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 <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 #include "utils.h"
6
7 void *domalloc(size_t len) {
8 void *x = malloc(len);
9 if (!x) {
10 fprintf(stderr, "Out of memory\n");
11 exit(1);
12 }
13 return x;
14 }
15
16 char *dostrdup(const char *s) {
17 char *x = strdup(s);
18 if (!x) {
19 fprintf(stderr, "Out of memory\n");
20 exit(1);
21 }
22 return x;
23 }