We know how big the global string table will be, so use that
[p5sagit/p5-mst-13.2.git] / x2p / util.c
index 547899f..20444de 100644 (file)
@@ -1,6 +1,7 @@
 /* $RCSfile: util.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:29 $
  *
- *    Copyright (c) 1991-1997, Larry Wall
+ *    Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999,
+ *    2000, 2001, 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.
@@ -40,6 +41,7 @@ safemalloc(MEM_SIZE size)
        exit(1);
     }
     /*NOTREACHED*/
+    return 0;
 }
 
 /* paranoid version of realloc */
@@ -64,6 +66,7 @@ saferealloc(Malloc_t where, MEM_SIZE size)
        exit(1);
     }
     /*NOTREACHED*/
+    return 0;
 }
 
 /* safe version of free */
@@ -174,13 +177,14 @@ growstr(char **strptr, int *curlen, int newlen)
 }
 
 void
-croak(char *pat,...)
+croak(const 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
@@ -188,27 +192,32 @@ croak(char *pat,...)
 }
 
 void
-fatal(char *pat,...)
+fatal(const 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);
 }
 
+#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;
 
     va_start(args, pat);
     vfprintf(stderr,pat,args);
+    va_end(args);
 #else
     fprintf(stderr,pat,a1,a2,a3,a4);
 #endif