chiark / gitweb /
spec.sgml: Update for update copyright notices
[userv.git] / both.c
diff --git a/both.c b/both.c
index 46cf85c73823f1ae16b49b2254a38f1f67c12faf..9fe88e962744a071b476408b935edbcfff06a8a0 100644 (file)
--- a/both.c
+++ b/both.c
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <string.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;