*** empty log message ***
[platform/upstream/coreutils.git] / src / c99-to-c89.diff
1 --- remove.c    26 Jun 2006 13:29:48 -0000      1.152
2 +++ remove.c    28 Jun 2006 06:58:51 -0000
3 @@ -202,9 +202,10 @@ pop_dir (Dirstack_state *ds)
4  {
5    size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t);
6    size_t *length = obstack_base (&ds->len_stack);
7 +  size_t top_len;
8  
9    assert (n_lengths > 0);
10 -  size_t top_len = length[n_lengths - 1];
11 +  top_len = length[n_lengths - 1];
12    assert (top_len >= 2);
13  
14    /* Pop the specified length of file name.  */
15 @@ -336,10 +337,11 @@ AD_stack_top (Dirstack_state const *ds)
16  static void
17  AD_stack_pop (Dirstack_state *ds)
18  {
19 +  struct AD_ent *top;
20    assert (0 < AD_stack_height (ds));
21  
22    /* operate on Active_dir.  pop and free top entry */
23 -  struct AD_ent *top = AD_stack_top (ds);
24 +  top = AD_stack_top (ds);
25    if (top->unremovable)
26      hash_free (top->unremovable);
27    obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
28 @@ -1031,6 +1033,7 @@ fd_to_subdirp (int fd_cwd, char const *f
29        return NULL;
30      }
31  
32 +  {
33    DIR *subdir_dirp = fdopendir (fd_sub);
34    if (subdir_dirp == NULL)
35      {
36 @@ -1039,6 +1042,7 @@ fd_to_subdirp (int fd_cwd, char const *f
37      }
38  
39    return subdir_dirp;
40 +  }
41  }
42  
43  /* Remove entries in the directory open on DIRP
44 @@ -1285,9 +1289,10 @@ remove_dir (int fd_cwd, Dirstack_state *
45         /* The name of the directory that we have just processed,
46            nominally removing all of its contents.  */
47         char *empty_dir;
48 +       int fd;
49  
50         AD_pop_and_chdir (&dirp, ds, &empty_dir);
51 -       int fd = (dirp != NULL ? dirfd (dirp) : AT_FDCWD);
52 +       fd = (dirp != NULL ? dirfd (dirp) : AT_FDCWD);
53         assert (dirp != NULL || AD_stack_height (ds) == 1);
54  
55         /* Try to remove EMPTY_DIR only if remove_cwd_entries succeeded.  */
56 @@ -1364,6 +1369,7 @@ rm_1 (Dirstack_state *ds, char const *fi
57    AD_push_initial (ds);
58    AD_INIT_OTHER_MEMBERS ();
59  
60 +  {
61    int fd_cwd = AT_FDCWD;
62    enum RM_status status = remove_entry (fd_cwd, ds, filename, x, NULL);
63    if (status == RM_NONEMPTY_DIR)
64 @@ -1380,6 +1386,7 @@ rm_1 (Dirstack_state *ds, char const *fi
65    ds_clear (ds);
66  
67    return status;
68 +  }
69  }
70  
71  /* Remove all files and/or directories specified by N_FILES and FILE.
72 @@ -1402,9 +1409,11 @@ rm (size_t n_files, char const *const *f
73         }
74  
75        cycle_check_init (&ds->cycle_check_state);
76 +      {
77        enum RM_status s = rm_1 (ds, file[i], x, &cwd_errno);
78        assert (VALID_STATUS (s));
79        UPDATE_STATUS (status, s);
80 +      }
81      }
82  
83    if (x->require_restore_cwd && cwd_errno)