chiark / gitweb /
@@ -7,7 +7,7 @@
[userv.git] / both.c
diff --git a/both.c b/both.c
index 46cf85c73823f1ae16b49b2254a38f1f67c12faf..24a31ffaee2b87ed570aeb859291a90dea3ef7a4 100644 (file)
--- a/both.c
+++ b/both.c
 #include <stdlib.h>
 #include <errno.h>
 
+#include "config.h"
 #include "both.h"
 
+void *xmalloc(size_t s) {
+  void *p;
+  p= malloc(s?s:1); if (!p) syscallerror("malloc");
+  return p;
+}
+
+void *xrealloc(void *p, size_t s) {
+  p= realloc(p,s);
+  if (!p) syscallerror("realloc");
+  return p;
+}
+
+char *xstrsave(const char *s) {
+  char *r;
+
+  r= xmalloc(strlen(s)+1);
+  strcpy(r,s);
+  return r;
+}
+
+
 int working_getc(FILE *file) {
   int c;