Blob


1 #include <u.h>
2 #include <libc.h>
3 #include <draw.h>
4 #include <plumb.h>
5 #include <9pclient.h>
6 #include "faces.h"
8 void*
9 emalloc(ulong sz)
10 {
11 void *v;
12 v = malloc(sz);
13 if(v == nil) {
14 fprint(2, "out of memory allocating %ld\n", sz);
15 exits("mem");
16 }
17 memset(v, 0, sz);
18 return v;
19 }
21 void*
22 erealloc(void *v, ulong sz)
23 {
24 v = realloc(v, sz);
25 if(v == nil) {
26 fprint(2, "out of memory allocating %ld\n", sz);
27 exits("mem");
28 }
29 return v;
30 }
32 char*
33 estrdup(char *s)
34 {
35 char *t;
36 if((t = strdup(s)) == nil) {
37 fprint(2, "out of memory in strdup(%.10s)\n", s);
38 exits("mem");
39 }
40 return t;
41 }