Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Goto considered harmful; remove dirloop: in favor o...



details:   https://anonhg.NetBSD.org/src/rev/0144b30fc901
branches:  trunk
changeset: 764367:0144b30fc901
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Apr 18 00:45:07 2011 +0000

description:
Goto considered harmful; remove dirloop: in favor of using a loop
continue.

This runs the "are we mounted?" test on every directory instead of
only sometimes; however, it's not exactly an expensive test (null
pointer check) and the prior logic wasn't exactly sensible -- it
checked at the beginning and after following a symlink but, for some
reason, not after crossing a mount point.

diffstat:

 sys/kern/vfs_lookup.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r f36177c088db -r 0144b30fc901 sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Mon Apr 18 00:43:56 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Mon Apr 18 00:45:07 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.176 2011/04/18 00:40:53 dholland Exp $        */
+/*     $NetBSD: vfs_lookup.c,v 1.177 2011/04/18 00:45:07 dholland Exp $        */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.176 2011/04/18 00:40:53 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.177 2011/04/18 00:45:07 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -1118,7 +1118,6 @@
                 * (currently, this may consume more than one)
                 */
 
-    dirloop:
                /*
                 * If we have a leading string of slashes, remove
                 * them, and just make sure the current node is a
@@ -1259,7 +1258,7 @@
                        }
                        searchdir = foundobj;
                        foundobj = NULL;
-                       goto dirloop;
+                       continue;
                }
 
     terminal:



Home | Main Index | Thread Index | Old Index