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: now the "goto alldone" can...



details:   https://anonhg.NetBSD.org/src/rev/8672f9a4a8ff
branches:  trunk
changeset: 764372:8672f9a4a8ff
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Apr 18 00:47:04 2011 +0000

description:
Goto considered harmful: now the "goto alldone" can be dropped by
reversing the sense of the associated test and using the big block I
moved a couple versions back (and didn't reindent on purpose) as the
body of the if statement.

There are now no gotos in namei_oneroot, only normal loop logic.

diffstat:

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

diffs (40 lines):

diff -r 8aa9fa727abe -r 8672f9a4a8ff sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c     Mon Apr 18 00:46:39 2011 +0000
+++ b/sys/kern/vfs_lookup.c     Mon Apr 18 00:47:04 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_lookup.c,v 1.181 2011/04/18 00:46:39 dholland Exp $        */
+/*     $NetBSD: vfs_lookup.c,v 1.182 2011/04/18 00:47:04 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.181 2011/04/18 00:46:39 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.182 2011/04/18 00:47:04 dholland Exp $");
 
 #include "opt_magiclinks.h"
 
@@ -1264,11 +1264,7 @@
                break;
        }
 
-       if (foundobj == NULL) {
-               goto alldone;
-       }
-
-       {
+       if (foundobj != NULL) {
                if (foundobj == ndp->ni_erootdir) {
                        /*
                         * We are about to return the emulation root.
@@ -1357,8 +1353,6 @@
                }
        }
 
- alldone:
-
        /*
         * Done.
         */



Home | Main Index | Thread Index | Old Index