ref: 44a3faf02ec337da6377fa9a00e4ea7cb7d4e913
dir: /alloc.c/
#include <u.h> #include <libc.h> #include <draw.h> void* emalloc(ulong n) { void *p; p = malloc(n); if(p == nil) sysfatal("malloc: %r"); setmalloctag(p, getcallerpc(&n)); return p; } void* erealloc(void *p, ulong n) { void *np; np = realloc(p, n); if(np == nil){ if(n == 0) return nil; sysfatal("realloc: %r"); } if(p == nil) setmalloctag(np, getcallerpc(&p)); else setrealloctag(np, getcallerpc(&p)); return np; } char * estrdup(char *s) { char *ns; ns = strdup(s); if(ns == nil) sysfatal("strdup: %r"); return ns; } Image* eallocimage(Display *d, Rectangle r, ulong chan, int repl, ulong col) { Image *i; i = allocimage(d, r, chan, repl, col); if(i == nil) sysfatal("allocimage: %r"); return i; }