X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=x2p%2Futil.c;h=6994e873f753e8be9add4a1ac1c834feae7c2d85;hb=1fcb18de6aa4bd3b565067cad38df0ca202f89d0;hp=f0875577fe07870d2972698310dc58070525c7b0;hpb=be3c0a43e1e6b1244032726df02a3ab450a3c4be;p=p5sagit%2Fp5-mst-13.2.git diff --git a/x2p/util.c b/x2p/util.c index f087557..6994e87 100644 --- a/x2p/util.c +++ b/x2p/util.c @@ -1,11 +1,10 @@ -/* $RCSfile: util.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:29 $ +/* util.c * - * Copyright (c) 1991-2002, Larry Wall + * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, + * 2000, 2001, 2005 by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. - * - * $Log: util.c,v $ */ #include "EXTERN.h" @@ -16,7 +15,7 @@ #include #define FLUSH -static char nomem[] = "Out of memory!\n"; +static const char nomem[] = "Out of memory!\n"; /* paranoid version of malloc */ @@ -80,19 +79,6 @@ safefree(Malloc_t where) free(where); } -/* safe version of string copy */ - -char * -safecpy(char *to, register char *from, register int len) -{ - register char *dest = to; - - if (from != Nullch) - for (len--; len && (*dest++ = *from++); len--) ; - *dest = '\0'; - return to; -} - /* copy a string up to some (non-backslashed) delimiter, if any */ char * @@ -155,7 +141,7 @@ instr(char *big, char *little) char * savestr(char *str) { - register char *newaddr = (char *) safemalloc((MEM_SIZE)(strlen(str)+1)); + register char * const newaddr = (char *) safemalloc((MEM_SIZE)(strlen(str)+1)); (void)strcpy(newaddr,str); return newaddr; @@ -176,22 +162,7 @@ growstr(char **strptr, int *curlen, int newlen) } void -croak(char *pat,...) -{ -#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); -} - -void -fatal(char *pat,...) +fatal(const char *pat,...) { #if defined(HAS_VPRINTF) va_list args; @@ -205,11 +176,11 @@ fatal(char *pat,...) exit(1); } -#if defined(__APPLE_CC__) +#if defined(DARWIN) __private_extern__ /* warn() conflicts with libc */ #endif void -warn(char *pat,...) +warn(const char *pat,...) { #if defined(HAS_VPRINTF) va_list args;