From 44a77f4851d3c819f9b364018a9695f332758a71 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 29 Jan 2013 23:53:55 +0000 Subject: [PATCH] www-cgi/: Move `xrealloc' to `ucgicommon'. Both programs will want it soon enough. --- www-cgi/ucgi.h | 1 + www-cgi/ucgicommon.c | 8 ++++++++ www-cgi/ucgitarget.c | 8 -------- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/www-cgi/ucgi.h b/www-cgi/ucgi.h index 5915321..5a51a77 100644 --- a/www-cgi/ucgi.h +++ b/www-cgi/ucgi.h @@ -32,6 +32,7 @@ void syserror(const char *m); void error(const char *m); void *xmalloc(size_t sz); void xsetenv(const char *en, const char *ev, int overwrite); +void *xrealloc(void *ptr, size_t sz); extern const char *const envok[]; extern const int nenvok; diff --git a/www-cgi/ucgicommon.c b/www-cgi/ucgicommon.c index 4a8749a..43b7d94 100644 --- a/www-cgi/ucgicommon.c +++ b/www-cgi/ucgicommon.c @@ -103,6 +103,14 @@ void *xmalloc(size_t sz) { return r; } +void *xrealloc(void *ptr, size_t sz) { + void *r; + + r= realloc(ptr,sz); + if (!r) syserror("realloc failed"); + return r; +} + void xsetenv(const char *en, const char *ev, int overwrite) { if (setenv(en,ev,overwrite)) syserror("setenv"); } diff --git a/www-cgi/ucgitarget.c b/www-cgi/ucgitarget.c index 4228951..e38ad30 100644 --- a/www-cgi/ucgitarget.c +++ b/www-cgi/ucgitarget.c @@ -32,14 +32,6 @@ #include "ucgi.h" -static void *xrealloc(void *ptr, size_t sz) { - void *r; - - r= realloc(ptr,sz); - if (!r) syserror("realloc failed"); - return r; -} - int main(int argc, const char **argv) { char *uservarn, *scriptpath, *newvar; const char *nextslash, *lastslash, *pathi, *ev, *ev2, *en, *scriptdir, *av; -- 2.30.2