Blob
1 #include <u.h>2 #include <libc.h>3 #include <auth.h>4 #include <fcall.h>5 #include <thread.h>6 #include "9p.h"8 void*9 emalloc9p(ulong sz)10 {11 void *v;13 if((v = malloc(sz)) == nil)14 sysfatal("out of memory allocating %lud", sz);15 memset(v, 0, sz);16 setmalloctag(v, getcallerpc(&sz));17 return v;18 }20 void*21 erealloc9p(void *v, ulong sz)22 {23 void *nv;25 if((nv = realloc(v, sz)) == nil)26 sysfatal("out of memory reallocating %lud", sz);27 if(v == nil)28 setmalloctag(nv, getcallerpc(&v));29 setrealloctag(nv, getcallerpc(&v));30 return nv;31 }33 char*34 estrdup9p(char *s)35 {36 char *t;38 if((t = strdup(s)) == nil)39 sysfatal("out of memory in strdup(%.20s)", s);40 setmalloctag(t, getcallerpc(&s));41 return t;42 }