X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=both.c;h=24a31ffaee2b87ed570aeb859291a90dea3ef7a4;hb=949af4df9625f3371e146f7c78f4f1a17a2bf6db;hp=46cf85c73823f1ae16b49b2254a38f1f67c12faf;hpb=b6c671fd90134d458ad4722ec3a99742bced1a34;p=userv.git diff --git a/both.c b/both.c index 46cf85c..24a31ff 100644 --- a/both.c +++ b/both.c @@ -31,8 +31,30 @@ #include #include +#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;