src/usr.bin/printf

Alexander 'alxl' Lobachov alxl at alxl.info
Fri Dec 31 12:06:13 PST 2004


* Remove (void) casts
* Remove register keywords
* Add WARNS 7

-- 
Alexander 'alxl' Lobachov	mailto:alxl at xxxxxxxxx
Index: src/usr.bin/printf/Makefile
===================================================================
RCS file: /home/cvs/DragonFly/src/usr.bin/printf/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- src/usr.bin/printf/Makefile	17 Jun 2003 04:29:30 -0000	1.2
+++ src/usr.bin/printf/Makefile	28 Dec 2004 03:03:10 -0000	1.3
@@ -3,5 +3,6 @@
 # $DragonFly$
 
 PROG=	printf
+WARNS?=	7
 
 .include <bsd.prog.mk>
Index: src/usr.bin/printf/printf.c
===================================================================
RCS file: /home/cvs/DragonFly/src/usr.bin/printf/printf.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- src/usr.bin/printf/printf.c	19 Mar 2004 16:37:24 -0000	1.5
+++ src/usr.bin/printf/printf.c	28 Dec 2004 03:03:10 -0000	1.6
@@ -64,15 +64,15 @@
 	char *b = NULL; \
 	if (fieldwidth) \
 		if (precision) \
-			(void)asprintf(&b, f, fieldwidth, precision, func); \
+			asprintf(&b, f, fieldwidth, precision, func); \
 		else \
-			(void)asprintf(&b, f, fieldwidth, func); \
+			asprintf(&b, f, fieldwidth, func); \
 	else if (precision) \
-		(void)asprintf(&b, f, precision, func); \
+		asprintf(&b, f, precision, func); \
 	else \
-		(void)asprintf(&b, f, func); \
+		asprintf(&b, f, func); \
 	if (b) { \
-		(void)fputs(b, stdout); \
+		fputs(b, stdout); \
 		free(b); \
 	} \
 } while (0)
@@ -102,7 +102,7 @@
 	char convch, nextch, *format, *fmt, *start;
 
 #ifndef BUILTIN
-	(void) setlocale(LC_NUMERIC, "");
+	setlocale(LC_NUMERIC, "");
 #endif
 	while ((ch = getopt(argc, argv, "")) != -1)
 		switch (ch) {
@@ -140,7 +140,7 @@
 			if (!*fmt) {
 				/* avoid infinite loop */
 				if (chopped) {
-					(void)printf("%s", start);
+					printf("%s", start);
 					return (rval);
 				}
 				if (end == 1) {
@@ -150,7 +150,7 @@
 				}
 				end = 1;
 				if (fmt > start)
-					(void)printf("%s", start);
+					printf("%s", start);
 				if (!*gargv)
 					return (rval);
 				fmt = format;
@@ -161,7 +161,7 @@
 				if (*++fmt != '%')
 					break;
 				*fmt++ = '\0';
-				(void)printf("%s", start);
+				printf("%s", start);
 				goto next;
 			}
 		}
@@ -308,10 +308,10 @@
 }
 
 static int
-escape(register char *fmt)
+escape(char *fmt)
 {
-	register char *store;
-	register int value, c;
+	char *store;
+	int value, c;
 
 	for (store = fmt; (c = *fmt); ++fmt, ++store) {
 		if (c != '\\') {
@@ -477,7 +477,7 @@
 static int
 asciicode(void)
 {
-	register int ch;
+	int ch;
 
 	ch = **gargv;
 	if (ch == '\'' || ch == '"')
@@ -489,5 +489,5 @@
 static void
 usage(void)
 {
-	(void)fprintf(stderr, "usage: printf format [arg ...]\n");
+	fprintf(stderr, "usage: printf format [arg ...]\n");
 }




More information about the Submit mailing list