Module Name:    src
Committed By:   bouyer
Date:           Sun May  3 13:21:36 UTC 2009

Modified Files:
        src/sys/kern [netbsd-5]: vfs_dirhash.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #732):
        sys/kern/vfs_dirhash.c: revision 1.10
PR port-vax/41315:
Previous code ususally works since compiler won't put gap between
those struct members but there is no reason to rely on that.
While here, I rewrite the loop using an usual idiom.  It shaves
both source and object code.


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.5 -r1.4.2.6 src/sys/kern/vfs_dirhash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/vfs_dirhash.c
diff -u src/sys/kern/vfs_dirhash.c:1.4.2.5 src/sys/kern/vfs_dirhash.c:1.4.2.6
--- src/sys/kern/vfs_dirhash.c:1.4.2.5	Tue Jan  6 23:01:49 2009
+++ src/sys/kern/vfs_dirhash.c	Sun May  3 13:21:36 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_dirhash.c,v 1.4.2.5 2009/01/06 23:01:49 snj Exp $ */
+/* $NetBSD: vfs_dirhash.c,v 1.4.2.6 2009/05/03 13:21:36 bouyer Exp $ */
 
 /*
  * Copyright (c) 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_dirhash.c,v 1.4.2.5 2009/01/06 23:01:49 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_dirhash.c,v 1.4.2.6 2009/05/03 13:21:36 bouyer Exp $");
 
 /* CLEAN UP! */
 #include <sys/param.h>
@@ -151,19 +151,16 @@
 		return;
 
 	for (hashline = 0; hashline < DIRHASH_HASHSIZE; hashline++) {
-		dirh_e = LIST_FIRST(&dirh->entries[hashline]);
-		while (dirh_e) {
+		while ((dirh_e =
+		    LIST_FIRST(&dirh->entries[hashline])) != NULL) {
 			LIST_REMOVE(dirh_e, next);
 			pool_put(&dirhash_entry_pool, dirh_e);
-			dirh_e = LIST_FIRST(&dirh->entries[hashline]);
 		}
 	}
-	dirh_e = LIST_FIRST(&dirh->free_entries);
 
-	while (dirh_e) {
+	while ((dirh_e = LIST_FIRST(&dirh->free_entries)) != NULL) {
 		LIST_REMOVE(dirh_e, next);
 		pool_put(&dirhash_entry_pool, dirh_e);
-		dirh_e = LIST_FIRST(&dirh->entries[hashline]);
 	}
 
 	dirh->flags &= ~DIRH_COMPLETE;

Reply via email to