diff options
author | Jacob Moody <moody@posixcafe.org> | 2022-12-12 21:36:38 +0000 |
---|---|---|
committer | Jacob Moody <moody@posixcafe.org> | 2022-12-12 21:36:38 +0000 |
commit | acefccf01e5e21456d7ce4eba7257770c944a461 (patch) | |
tree | 0993bee7d4541fb19027e8e1aa206846696ebeb2 /sys/src/lib9p/mem.c | |
parent | a7b30a349b6388b2eed6a735d3248eeba5198baa (diff) |
lib9p: e*9p error tidy
sysfatal has consistent behavior regardless if the
user is threaded.
Diffstat (limited to 'sys/src/lib9p/mem.c')
-rw-r--r-- | sys/src/lib9p/mem.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/sys/src/lib9p/mem.c b/sys/src/lib9p/mem.c index ef7c0515f..943dbb664 100644 --- a/sys/src/lib9p/mem.c +++ b/sys/src/lib9p/mem.c @@ -9,10 +9,8 @@ emalloc9p(ulong sz) { void *v; - if((v = malloc(sz)) == nil) { - fprint(2, "out of memory allocating %lud\n", sz); - exits("mem"); - } + if((v = malloc(sz)) == nil) + sysfatal("out of memory allocating %lud", sz); memset(v, 0, sz); setmalloctag(v, getcallerpc(&sz)); return v; @@ -23,10 +21,8 @@ erealloc9p(void *v, ulong sz) { void *nv; - if((nv = realloc(v, sz)) == nil && sz != 0) { - fprint(2, "out of memory allocating %lud\n", sz); - exits("mem"); - } + if((nv = realloc(v, sz)) == nil && sz != 0) + sysfatal("out of memory allocating %lud", sz); if(v == nil) setmalloctag(nv, getcallerpc(&v)); setrealloctag(nv, getcallerpc(&v)); @@ -38,10 +34,8 @@ estrdup9p(char *s) { char *t; - if((t = strdup(s)) == nil) { - fprint(2, "out of memory in strdup(%.10s)\n", s); - exits("mem"); - } + if((t = strdup(s)) == nil) + sysfatal("out of memory in strdup(%.10s)", s); setmalloctag(t, getcallerpc(&s)); return t; } |