aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/faces/util.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-10-31 14:47:39 +0000
committerrsc <devnull@localhost>2005-10-31 14:47:39 +0000
commitb330c942b468ab82fd8853590145187e859258cb (patch)
treecb66b302b657bf0e966695fa0ab1d9596da234a0 /src/cmd/faces/util.c
parent663ddde9d07417ab51239c0c4305708a1a319c62 (diff)
downloadplan9port-b330c942b468ab82fd8853590145187e859258cb.tar.gz
plan9port-b330c942b468ab82fd8853590145187e859258cb.tar.bz2
plan9port-b330c942b468ab82fd8853590145187e859258cb.zip
initial faces (John Cummings)
Diffstat (limited to 'src/cmd/faces/util.c')
-rw-r--r--src/cmd/faces/util.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/cmd/faces/util.c b/src/cmd/faces/util.c
new file mode 100644
index 00000000..22f57549
--- /dev/null
+++ b/src/cmd/faces/util.c
@@ -0,0 +1,42 @@
+#include <u.h>
+#include <libc.h>
+#include <draw.h>
+#include <plumb.h>
+#include <9pclient.h>
+#include "faces.h"
+
+void*
+emalloc(ulong sz)
+{
+ void *v;
+ v = malloc(sz);
+ if(v == nil) {
+ fprint(2, "out of memory allocating %ld\n", sz);
+ exits("mem");
+ }
+ memset(v, 0, sz);
+ return v;
+}
+
+void*
+erealloc(void *v, ulong sz)
+{
+ v = realloc(v, sz);
+ if(v == nil) {
+ fprint(2, "out of memory allocating %ld\n", sz);
+ exits("mem");
+ }
+ return v;
+}
+
+char*
+estrdup(char *s)
+{
+ char *t;
+ if((t = strdup(s)) == nil) {
+ fprint(2, "out of memory in strdup(%.10s)\n", s);
+ exits("mem");
+ }
+ return t;
+}
+