bin/93630: small cleanup of rcorder

Divacky Roman xdivac02 at stud.fit.vutbr.cz
Tue Feb 21 01:00:18 PST 2006


>Number:         93630
>Category:       bin
>Synopsis:       small cleanup of rcorder
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 21 09:00:17 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Divacky Roman
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
home
>Environment:
FreeBSD witten 7.0-CURRENT FreeBSD 7.0-CURRENT #126: Sat Feb 11 18:48:12 CET
2006     root at witten:/usr/obj/usr/src/sys/NEOLOGISM  i386


	
>Description:

small cleanup of rcorder, more to come hopefully 

>How-To-Repeat:
apply the patch
>Fix:

? cscope.out
Index: hash.c
===================================================================
RCS file: /home/ncvs/src/sbin/rcorder/hash.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 hash.c
--- hash.c	16 Jun 2001 07:16:14 -0000	1.1.1.1
+++ hash.c	16 Feb 2006 21:02:24 -0000
@@ -53,6 +53,7 @@
 
 #include <sys/types.h>
 
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -103,15 +104,15 @@
 
 void
 Hash_InitTable(t, numBuckets)
-	register Hash_Table *t;	/* Structure to use to hold table. */
+	Hash_Table *t;	/* Structure to use to hold table. */
 	int numBuckets;		/* How many buckets to create for starters.
 				 * This number is rounded up to a power of
 				 * two.   If <= 0, a reasonable default is
 				 * chosen. The table will grow in size later
 				 * as needed. */
 {
-	register int i;
-	register struct Hash_Entry **hp;
+	int i;
+	struct Hash_Entry **hp;
 
 	/*
 	 * Round up the size to a power of two.
@@ -152,8 +153,8 @@
 Hash_DeleteTable(t)
 	Hash_Table *t;
 {
-	register struct Hash_Entry **hp, *h, *nexth = NULL;
-	register int i;
+	struct Hash_Entry **hp, *h, *nexth = NULL;
+	int i;
 
 	for (hp = t->bucketPtr, i = t->size; --i >= 0;) {
 		for (h = *hp++; h != NULL; h = nexth) {
@@ -193,9 +194,9 @@
 	Hash_Table *t;		/* Hash table to search. */
 	char *key;		/* A hash key. */
 {
-	register Hash_Entry *e;
-	register unsigned h;
-	register char *p;
+	Hash_Entry *e;
+	unsigned h;
+	char *p;
 
 	for (h = 0, p = key; *p;)
 		h = (h << 5) - h + *p++;
@@ -227,14 +228,14 @@
 
 Hash_Entry *
 Hash_CreateEntry(t, key, newPtr)
-	register Hash_Table *t;	/* Hash table to search. */
+	Hash_Table *t;	/* Hash table to search. */
 	char *key;		/* A hash key. */
-	Boolean *newPtr;	/* Filled in with TRUE if new entry created,
+	bool *newPtr;		/* Filled in with TRUE if new entry created,
 				 * FALSE otherwise. */
 {
-	register Hash_Entry *e;
-	register unsigned h;
-	register char *p;
+	Hash_Entry *e;
+	unsigned h;
+	char *p;
 	int keylen;
 	struct Hash_Entry **hp;
 
@@ -249,7 +250,7 @@
 	for (e = t->bucketPtr[h & t->mask]; e != NULL; e = e->next) {
 		if (e->namehash == h && strcmp(e->name, p) == 0) {
 			if (newPtr != NULL)
-				*newPtr = FALSE;
+				*newPtr = false;
 			return (e);
 		}
 	}
@@ -271,7 +272,7 @@
 	t->numEntries++;
 
 	if (newPtr != NULL)
-		*newPtr = TRUE;
+		*newPtr = true;
 	return (e);
 }
 
@@ -297,7 +298,7 @@
 	Hash_Table *t;
 	Hash_Entry *e;
 {
-	register Hash_Entry **hp, *p;
+	Hash_Entry **hp, *p;
 
 	if (e == NULL)
 		return;
@@ -336,7 +337,7 @@
 Hash_Entry *
 Hash_EnumFirst(t, searchPtr)
 	Hash_Table *t;			/* Table to be searched. */
-	register Hash_Search *searchPtr;/* Area in which to keep state
+	Hash_Search *searchPtr;/* Area in which to keep state
 					 * about search.*/
 {
 	searchPtr->tablePtr = t;
@@ -365,10 +366,10 @@
 
 Hash_Entry *
 Hash_EnumNext(searchPtr)
-	register Hash_Search *searchPtr; /* Area used to keep state about
+	Hash_Search *searchPtr; /* Area used to keep state about
 					    search. */
 {
-	register Hash_Entry *e;
+	Hash_Entry *e;
 	Hash_Table *t = searchPtr->tablePtr;
 
 	/*
@@ -411,11 +412,11 @@
 
 static void
 RebuildTable(t)
-	register Hash_Table *t;
+	Hash_Table *t;
 {
-	register Hash_Entry *e, *next = NULL, **hp, **xp;
-	register int i, mask;
-        register Hash_Entry **oldhp;
+	Hash_Entry *e, *next = NULL, **hp, **xp;
+	int i, mask;
+        Hash_Entry **oldhp;
 	int oldsize;
 
 	oldhp = t->bucketPtr;
Index: hash.h
===================================================================
RCS file: /home/ncvs/src/sbin/rcorder/hash.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 hash.h
--- hash.h	16 Jun 2001 07:16:14 -0000	1.1.1.1
+++ hash.h	16 Feb 2006 21:02:24 -0000
@@ -119,12 +119,12 @@
 
 #define	Hash_Size(n)	(((n) + sizeof (int) - 1) / sizeof (int))
 
-void Hash_InitTable __P((Hash_Table *, int));
-void Hash_DeleteTable __P((Hash_Table *));
-Hash_Entry *Hash_FindEntry __P((Hash_Table *, char *));
-Hash_Entry *Hash_CreateEntry __P((Hash_Table *, char *, Boolean *));
-void Hash_DeleteEntry __P((Hash_Table *, Hash_Entry *));
-Hash_Entry *Hash_EnumFirst __P((Hash_Table *, Hash_Search *));
-Hash_Entry *Hash_EnumNext __P((Hash_Search *));
+void Hash_InitTable (Hash_Table *, int);
+void Hash_DeleteTable (Hash_Table *);
+Hash_Entry *Hash_FindEntry (Hash_Table *, char *);
+Hash_Entry *Hash_CreateEntry (Hash_Table *, char *, bool *);
+void Hash_DeleteEntry (Hash_Table *, Hash_Entry *);
+Hash_Entry *Hash_EnumFirst (Hash_Table *, Hash_Search *);
+Hash_Entry *Hash_EnumNext (Hash_Search *);
 
 #endif /* _HASH */
Index: rcorder.c
===================================================================
RCS file: /home/ncvs/src/sbin/rcorder/rcorder.c,v
retrieving revision 1.2
diff -u -r1.2 rcorder.c
--- rcorder.c	17 Jan 2006 08:01:00 -0000	1.2
+++ rcorder.c	16 Feb 2006 21:02:24 -0000
@@ -41,6 +41,7 @@
 #include <sys/stat.h>
 
 #include <err.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -77,12 +78,9 @@
 int file_count;
 char **file_list;
 
-typedef int bool;
-#define TRUE 1
-#define FALSE 0
 typedef bool flag;
-#define SET TRUE
-#define RESET FALSE
+#define SET true
+#define RESET false
 
 Hash_Table provide_hash_s, *provide_hash;
 
@@ -130,27 +128,27 @@
 strnodelist *keep_list;
 strnodelist *skip_list;
 
-void do_file __P((filenode *fnode));
-void strnode_add __P((strnodelist **, char *, filenode *));
-int skip_ok __P((filenode *fnode));
-int keep_ok __P((filenode *fnode));
-void satisfy_req __P((f_reqnode *rnode, char *filename));
-void crunch_file __P((char *));
-void parse_require __P((filenode *, char *));
-void parse_provide __P((filenode *, char *));
-void parse_before __P((filenode *, char *));
-void parse_keywords __P((filenode *, char *));
-filenode *filenode_new __P((char *));
-void add_require __P((filenode *, char *));
-void add_provide __P((filenode *, char *));
-void add_before __P((filenode *, char *));
-void add_keyword __P((filenode *, char *));
-void insert_before __P((void));
-Hash_Entry *make_fake_provision __P((filenode *));
-void crunch_all_files __P((void));
-void initialize __P((void));
-void generate_ordering __P((void));
-int main __P((int, char *[]));
+void do_file (filenode *fnode);
+void strnode_add (strnodelist **, char *, filenode *);
+int skip_ok (filenode *fnode);
+int keep_ok (filenode *fnode);
+void satisfy_req (f_reqnode *rnode, char *filename);
+void crunch_file (char *);
+void parse_require (filenode *, char *);
+void parse_provide (filenode *, char *);
+void parse_before (filenode *, char *);
+void parse_keywords (filenode *, char *);
+filenode *filenode_new (char *);
+void add_require (filenode *, char *);
+void add_provide (filenode *, char *);
+void add_before (filenode *, char *);
+void add_keyword (filenode *, char *);
+void insert_before (void);
+Hash_Entry *make_fake_provision (filenode *);
+void crunch_all_files (void);
+void initialize (void);
+void generate_ordering (void);
+int main (int, char *[]);
 
 int
 main(argc, argv)
@@ -270,7 +268,7 @@
 {
 	Hash_Entry *entry;
 	f_reqnode *rnode;
-	int new;
+	bool new;
 
 	entry = Hash_CreateEntry(provide_hash, s, &new);
 	if (new)
@@ -293,7 +291,7 @@
 	Hash_Entry *entry;
 	f_provnode *f_pnode;
 	provnode *pnode, *head;
-	int new;
+	bool new;
 
 	entry = Hash_CreateEntry(provide_hash, s, &new);
 	head = Hash_GetValue(entry);
@@ -541,7 +539,7 @@
 	f_provnode *f_pnode;
 	provnode *head, *pnode;
 	static	int i = 0;
-	int	new;
+	bool	new;
 	char buffer[30];
 
 	do {
@@ -587,7 +585,7 @@
 	provnode *pnode;
 	f_reqnode *rnode;
 	strnodelist *bl;
-	int new;
+	bool new;
 	
 	while (bl_list != NULL) {
 		bl = bl_list->next;
Index: sprite.h
===================================================================
RCS file: /home/ncvs/src/sbin/rcorder/sprite.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sprite.h
--- sprite.h	16 Jun 2001 07:16:14 -0000	1.1.1.1
+++ sprite.h	16 Feb 2006 21:02:24 -0000
@@ -51,19 +51,6 @@
 
 
 /*
- * A boolean type is defined as an integer, not an enum. This allows a
- * boolean argument to be an expression that isn't strictly 0 or 1 valued.
- */
-
-typedef int Boolean;
-#ifndef TRUE
-#define TRUE	1
-#endif /* TRUE */
-#ifndef FALSE
-#define FALSE	0
-#endif /* FALSE */
-
-/*
  * Functions that must return a status can return a ReturnStatus to
  * indicate success or type of failure.
  */
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list