* src/remove.c (rm): Move cycle_check_init call into callee...
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 25 Nov 2006 10:13:05 +0000 (11:13 +0100)
committerJim Meyering <jim@meyering.net>
Sun, 26 Nov 2006 16:40:37 +0000 (17:40 +0100)
Use an else clause in place of a "continue" statement.

Signed-off-by: Paul Eggert <eggert@cs.ucla.edu>
ChangeLog
src/remove.c

index 6596156..5152963 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,9 @@
        (AD_ensure_initialized): New function.
        (AD_mark_helper): Use it, to avoid the need for declaration
        after statement.
+       (rm): Move cycle_check_init call into callee...
+       (rm_1): ...here.
+       Use an else clause in place of a "continue" statement.
 
 2006-11-25  Jim Meyering  <jim@meyering.net>
 
index f6fee66..06d2f82 100644 (file)
@@ -1479,6 +1479,7 @@ rm_1 (Dirstack_state *ds, char const *filename,
 
   struct stat st;
   cache_stat_init (&st);
+  cycle_check_init (&ds->cycle_check_state);
   if (x->root_dev_ino)
     {
       if (cache_fstatat (AT_FDCWD, filename, &st, AT_SYMLINK_NOFOLLOW) != 0)
@@ -1532,13 +1533,13 @@ rm (size_t n_files, char const *const *file, struct rm_options const *x)
        {
          error (0, 0, _("cannot remove relative-named %s"), quote (file[i]));
          status = RM_ERROR;
-         continue;
        }
-
-      cycle_check_init (&ds->cycle_check_state);
-      enum RM_status s = rm_1 (ds, file[i], x, &cwd_errno);
-      assert (VALID_STATUS (s));
-      UPDATE_STATUS (status, s);
+      else
+       {
+         enum RM_status s = rm_1 (ds, file[i], x, &cwd_errno);
+         assert (VALID_STATUS (s));
+         UPDATE_STATUS (status, s);
+       }
     }
 
   if (x->require_restore_cwd && cwd_errno)