X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=x2p%2Futil.c;h=f0875577fe07870d2972698310dc58070525c7b0;hb=28e9118f23dc1b501af6ee6c0b70d68a5df2d3f2;hp=3d3b99a952e578b2f5e7ef95404d8e4b1a7acf86;hpb=f0f333f45536802923a359d930d1dcfd5b4589ea;p=p5sagit%2Fp5-mst-13.2.git diff --git a/x2p/util.c b/x2p/util.c index 3d3b99a..f087557 100644 --- a/x2p/util.c +++ b/x2p/util.c @@ -1,6 +1,6 @@ /* $RCSfile: util.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:29 $ * - * Copyright (c) 1991-1997, Larry Wall + * Copyright (c) 1991-2002, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -13,9 +13,7 @@ #include "INTERN.h" #include "util.h" -#ifdef I_STDARG -# include -#endif +#include #define FLUSH static char nomem[] = "Out of memory!\n"; @@ -24,7 +22,7 @@ static char nomem[] = "Out of memory!\n"; Malloc_t -safemalloc(size_t size) +safemalloc(MEM_SIZE size) { Malloc_t ptr; @@ -42,12 +40,13 @@ safemalloc(size_t size) exit(1); } /*NOTREACHED*/ + return 0; } /* paranoid version of realloc */ Malloc_t -saferealloc(void *where, size_t size) +saferealloc(Malloc_t where, MEM_SIZE size) { Malloc_t ptr; @@ -66,12 +65,13 @@ saferealloc(void *where, size_t size) exit(1); } /*NOTREACHED*/ + return 0; } /* safe version of free */ Free_t -safefree(void *where) +safefree(Malloc_t where) { #ifdef DEBUGGING if (debug & 128) @@ -176,20 +176,14 @@ growstr(char **strptr, int *curlen, int newlen) } void -#if defined(I_STDARG) && defined(HAS_VPRINTF) croak(char *pat,...) -#else /* I_STDARG */ -/*VARARGS1*/ -croak(pat,a1,a2,a3,a4) - char *pat; - int a1,a2,a3,a4; -#endif /* I_STDARG */ { -#if defined(I_STDARG) && defined(HAS_VPRINTF) +#if defined(HAS_VPRINTF) va_list args; va_start(args, pat); vfprintf(stderr,pat,args); + va_end(args); #else fprintf(stderr,pat,a1,a2,a3,a4); #endif @@ -197,41 +191,32 @@ croak(pat,a1,a2,a3,a4) } void -#if defined(I_STDARG) && defined(HAS_VPRINTF) fatal(char *pat,...) -#else /* I_STDARG */ -/*VARARGS1*/ -fatal(pat,a1,a2,a3,a4) - char *pat; - int a1,a2,a3,a4; -#endif /* I_STDARG */ { -#if defined(I_STDARG) && defined(HAS_VPRINTF) +#if defined(HAS_VPRINTF) va_list args; va_start(args, pat); vfprintf(stderr,pat,args); + va_end(args); #else fprintf(stderr,pat,a1,a2,a3,a4); #endif exit(1); } +#if defined(__APPLE_CC__) +__private_extern__ /* warn() conflicts with libc */ +#endif void -#if defined(I_STDARG) && defined(HAS_VPRINTF) warn(char *pat,...) -#else /* I_STDARG */ -/*VARARGS1*/ -warn(pat,a1,a2,a3,a4) - char *pat; - int a1,a2,a3,a4; -#endif /* I_STDARG */ { -#if defined(I_STDARG) && defined(HAS_VPRINTF) +#if defined(HAS_VPRINTF) va_list args; va_start(args, pat); vfprintf(stderr,pat,args); + va_end(args); #else fprintf(stderr,pat,a1,a2,a3,a4); #endif