usr.bin/make cleanup some minor coding style problems

Max Okumoto okumoto at ucsd.edu
Wed Nov 17 16:56:45 PST 2004


Patches collected from FreeBSD
Date: 2002/06/13 09:54:16
Date: 2002/06/13 09:55:29
Date: 2002/06/13 09:57:53
Date: 2002/07/15 07:57:25
				Max Okumoto
---------------------
PatchSet 239
Date: 2002/06/13 09:54:16
Author: jmallett
Log:
Don't do stupid things to avoid unused parameters, mark them __unused.

Members: 
	util.c:

Index: main.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/util.c,v
diff -u -r1.64 -r1.65
--- util.c	12 Jun 2002 04:18:31 -0000	1.64
+++ util.c	13 Jun 2002 08:54:16 -0000	1.65
@@ -1309,8 +1309,8 @@
 int
 PrintAddr(a, b)
     void * a;
-    void * b;
+    void * b __unused;
 {
     printf("%lx ", (unsigned long) a);
-    return b ? 0 : 0;
+    return 0;
 }
---------------------
PatchSet 240
Date: 2002/06/13 09:55:29
Author: jmallett
Log:
Use %p to print a pointer, not %lx and a cast to (unsigned long).  Yuck.

Members: 
	main.c:

Index: main.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/util.c,v
--- util.c	13 Jun 2002 08:54:16 -0000	1.65
+++ util.c	13 Jun 2002 08:55:29 -0000	1.66
@@ -1311,6 +1311,6 @@
     void * a;
     void * b __unused;
 {
-    printf("%lx ", (unsigned long) a);
+    printf("%p ", a);
     return 0;
 }
---------------------
PatchSet 241
Date: 2002/06/13 09:57:53
Author: jmallett
Log:
Avoid classy use of a variable one time with a constant value.

Members: 
	buf.c:1.15->1.16 

Index: buf.c
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/buf.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- buf.c	13 Apr 2002 10:57:56 -0000	1.15
+++ buf.c	13 Jun 2002 08:57:53 -0000	1.16
@@ -96,9 +96,8 @@
     Buffer bp;
     int    byte;
 {
-    int nbytes = 1;
     bp->left = 0;
-    BufExpand (bp, nbytes);
+    BufExpand (bp, 1);
 
     *bp->inPtr++ = byte;
     bp->left--;
---------------------
PatchSet 254
Date: 2002/07/15 07:57:25
Author: jmallett
Log:
Bit-width fields should be of type 'int'.

Members: 
	lst.lib/lstInt.h:1.9->1.10 

Index: lst.lib/lstInt.h
===================================================================
RCS file: /usr/home/okumoto/Work/make/fbsd-cvs/src/usr.bin/make/lst.lib/lstInt.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- lst.lib/lstInt.h	2 Dec 2000 20:24:42 -0000	1.9
+++ lst.lib/lstInt.h	15 Jul 2002 06:57:25 -0000	1.10
@@ -50,7 +50,7 @@
 typedef struct ListNode {
 	struct ListNode	*prevPtr;   /* previous element in list */
 	struct ListNode	*nextPtr;   /* next in list */
-	short	    	useCount:8, /* Count of functions using the node.
+	int	    	useCount:8, /* Count of functions using the node.
 				     * node may not be deleted until count
 				     * goes to 0 */
  	    	    	flags:8;    /* Node status flags */




More information about the Submit mailing list