const cleanup for scheck

roland at redhat.com roland at redhat.com
Sat Feb 25 02:52:01 UTC 2012


Please consider including these changes, which reduce some ugly warnings
compiling scheck.c for zic.


Thanks,
Roland


Index: private.h
===================================================================
RCS file: /cvs/glibc/libc/timezone/private.h,v
retrieving revision 1.11
diff -u -r1.11 private.h
--- private.h	10 Jan 2006 07:55:37 -0000	1.11
+++ private.h	10 Jan 2006 09:46:12 -0000
@@ -218,7 +218,7 @@
 void *	irealloc P((void * pointer, int size));
 void	icfree P((char * pointer));
 void	ifree P((char * pointer));
-char *	scheck P((const char *string, char *format));
+const char *scheck P((const char *string, const char *format));
 
 /*
 ** Finally, some convenience items.
Index: scheck.c
===================================================================
RCS file: /cvs/glibc/libc/timezone/scheck.c,v
retrieving revision 1.3
diff -u -r1.3 scheck.c
--- scheck.c	6 Aug 2005 05:40:57 -0000	1.3
+++ scheck.c	10 Jan 2006 09:46:12 -0000
@@ -8,20 +8,19 @@
 
 #include "private.h"
 
-char *
+const char *
 scheck(string, format)
 const char * const	string;
-char * const		format;
+const char * const	format;
 {
 	register char *		fbuf;
 	register const char *	fp;
 	register char *		tp;
 	register int		c;
-	register char *		result;
+	register const char *	result;
 	char			dummy;
-	static char		nada;
 
-	result = &nada;
+	result = "";
 	if (string == NULL || format == NULL)
 		return result;
 	fbuf = imalloc((int) (2 * strlen(format) + 4)); @@ -53,7 +52,7
@@
 	*tp++ = 'c';
 	*tp = '\0';
 	if (sscanf(string, fbuf, &dummy) != 1)
-		result = (char *) format;
+		result = format;
 	ifree(fbuf);
 	return result;
 }




More information about the tz mailing list