Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ext2fs ext2fs_remove(): use 'else' to eliminate need...



details:   https://anonhg.NetBSD.org/src/rev/266cf29e3318
branches:  trunk
changeset: 538631:266cf29e3318
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Wed Oct 23 19:52:16 2002 +0000

description:
ext2fs_remove(): use 'else' to eliminate need for goto (and improve
readibility, even)

diffstat:

 sys/ufs/ext2fs/ext2fs_vnops.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (40 lines):

diff -r 74f03264cd1c -r 266cf29e3318 sys/ufs/ext2fs/ext2fs_vnops.c
--- a/sys/ufs/ext2fs/ext2fs_vnops.c     Wed Oct 23 19:50:30 2002 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vnops.c     Wed Oct 23 19:52:16 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_vnops.c,v 1.42 2002/10/23 09:15:05 jdolecek Exp $       */
+/*     $NetBSD: ext2fs_vnops.c,v 1.43 2002/10/23 19:52:16 jdolecek Exp $       */
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.42 2002/10/23 09:15:05 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.43 2002/10/23 19:52:16 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -505,14 +505,14 @@
                (ip->i_e2fs_flags & (EXT2_IMMUTABLE | EXT2_APPEND)) ||
                (VTOI(dvp)->i_e2fs_flags & EXT2_APPEND)) {
                error = EPERM;
-               goto out;
+       } else {
+               error = ext2fs_dirremove(dvp, ap->a_cnp);
+               if (error == 0) {
+                       ip->i_e2fs_nlink--;
+                       ip->i_flag |= IN_CHANGE;
+               }
        }
-       error = ext2fs_dirremove(dvp, ap->a_cnp);
-       if (error == 0) {
-               ip->i_e2fs_nlink--;
-               ip->i_flag |= IN_CHANGE;
-       }
-out:
+
        VN_KNOTE(vp, NOTE_DELETE);
        VN_KNOTE(dvp, NOTE_WRITE);
        if (dvp == vp)



Home | Main Index | Thread Index | Old Index