* src/remove.c (remove_dir): Move new cache_stat_init call onto
authorJim Meyering <jim@meyering.net>
Mon, 11 Sep 2006 13:22:04 +0000 (13:22 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 11 Sep 2006 13:22:04 +0000 (13:22 +0000)
it's own line.
(rm_1): Move declaration of "st" and new cache_stat_init call
"down" to nearer where they're used.

ChangeLog
src/remove.c

index ff97f70..13fa387 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-09-11  Jim Meyering  <jim@meyering.net>
+
+       * src/remove.c (remove_dir): Move new cache_stat_init call onto
+       it's own line.
+       (rm_1): Move declaration of "st" and new cache_stat_init call
+       "down" to nearer where they're used.
+
 2006-09-10  Paul Eggert  <eggert@cs.ucla.edu>
 
        * src/expr.c (eval6): Fix buffer overrun, or bad performance, if
index cda1d30..670ba48 100644 (file)
@@ -1346,8 +1346,9 @@ remove_dir (int fd_cwd, Dirstack_state *ds, char const *dir,
               prompts the user.  E.g., we already know that D is a directory
               and that it's almost certainly empty, yet we lstat it.
               But that's no big deal since we're interactive.  */
-           struct stat empty_st;  cache_stat_init (&empty_st);
+           struct stat empty_st;
            Ternary is_empty;
+           cache_stat_init (&empty_st);
            enum RM_status s = prompt (fd, ds, empty_dir, &empty_st, x,
                                       PA_REMOVE_DIR, &is_empty);
 
@@ -1403,9 +1404,6 @@ static enum RM_status
 rm_1 (Dirstack_state *ds, char const *filename,
       struct rm_options const *x, int *cwd_errno)
 {
-  struct stat st;
-  cache_stat_init (&st);
-
   char const *base = last_component (filename);
   if (dot_or_dotdot (base))
     {
@@ -1415,6 +1413,9 @@ rm_1 (Dirstack_state *ds, char const *filename,
             quote_n (0, base), quote_n (1, filename));
       return RM_ERROR;
     }
+
+  struct stat st;
+  cache_stat_init (&st);
   if (x->root_dev_ino)
     {
       if (cache_fstatat (AT_FDCWD, filename, &st, AT_SYMLINK_NOFOLLOW) != 0)