bcc058475f48de0402f5c83c1ac4e72897fe84d3
[platform/upstream/coreutils.git] / src / c99-to-c89.diff
1 Index: src/remove.c
2 ===================================================================
3 RCS file: /fetish/cu/src/remove.c,v
4 retrieving revision 1.158
5 diff -u -p -u -r1.158 remove.c
6 --- src/remove.c        3 Sep 2006 02:54:51 -0000       1.158
7 +++ src/remove.c        6 Sep 2006 18:57:46 -0000
8 @@ -245,9 +245,10 @@ pop_dir (Dirstack_state *ds)
9  {
10    size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t);
11    size_t *length = obstack_base (&ds->len_stack);
12 +  size_t top_len;
13
14    assert (n_lengths > 0);
15 -  size_t top_len = length[n_lengths - 1];
16 +  top_len = length[n_lengths - 1];
17    assert (top_len >= 2);
18
19    /* Pop the specified length of file name.  */
20 @@ -379,10 +380,11 @@ AD_stack_top (Dirstack_state const *ds)
21  static void
22  AD_stack_pop (Dirstack_state *ds)
23  {
24 +  struct AD_ent *top;
25    assert (0 < AD_stack_height (ds));
26
27    /* operate on Active_dir.  pop and free top entry */
28 -  struct AD_ent *top = AD_stack_top (ds);
29 +  top = AD_stack_top (ds);
30    if (top->unremovable)
31      hash_free (top->unremovable);
32    obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
33 @@ -549,6 +551,7 @@ AD_mark_helper (Hash_table **ht, char *f
34        if (*ht == NULL)
35         xalloc_die ();
36      }
37 +  {
38    void *ent = hash_insert (*ht, filename);
39    if (ent == NULL)
40      xalloc_die ();
41 @@ -557,7 +560,7 @@ AD_mark_helper (Hash_table **ht, char *f
42        if (ent != filename)
43         free (filename);
44      }
45 -
46 +  }
47  }
48
49  /* Mark FILENAME (in current directory) as unremovable.  */
50 @@ -1129,6 +1132,7 @@ fd_to_subdirp (int fd_cwd, char const *f
51        return NULL;
52      }
53
54 +  {
55    DIR *subdir_dirp = fdopendir (fd_sub);
56    if (subdir_dirp == NULL)
57      {
58 @@ -1137,6 +1141,7 @@ fd_to_subdirp (int fd_cwd, char const *f
59      }
60
61    return subdir_dirp;
62 +  }
63  }
64
65  /* Remove entries in the directory open on DIRP
66 @@ -1389,9 +1394,10 @@ remove_dir (int fd_cwd, Dirstack_state *
67         /* The name of the directory that we have just processed,
68            nominally removing all of its contents.  */
69         char *empty_dir;
70 +       int fd;
71
72         AD_pop_and_chdir (&dirp, ds, &empty_dir);
73 -       int fd = (dirp != NULL ? dirfd (dirp) : AT_FDCWD);
74 +       fd = (dirp != NULL ? dirfd (dirp) : AT_FDCWD);
75         assert (dirp != NULL || AD_stack_height (ds) == 1);
76
77         /* Try to remove EMPTY_DIR only if remove_cwd_entries succeeded.  */
78 @@ -1403,8 +1409,9 @@ remove_dir (int fd_cwd, Dirstack_state *
79                But that's no big deal since we're interactive.  */
80             struct stat empty_st;
81             Ternary is_empty;
82 +           enum RM_status s;
83             cache_stat_init (&empty_st);
84 -           enum RM_status s = prompt (fd, ds, empty_dir, &empty_st, x,
85 +           s = prompt (fd, ds, empty_dir, &empty_st, x,
86                                        PA_REMOVE_DIR, &is_empty);
87
88             if (s != RM_OK)
89 @@ -1469,6 +1476,7 @@ rm_1 (Dirstack_state *ds, char const *fi
90        return RM_ERROR;
91      }
92
93 +  {
94    struct stat st;
95    cache_stat_init (&st);
96    if (x->root_dev_ino)
97 @@ -1490,6 +1498,7 @@ rm_1 (Dirstack_state *ds, char const *fi
98    AD_push_initial (ds);
99    AD_INIT_OTHER_MEMBERS ();
100
101 +  {
102    int fd_cwd = AT_FDCWD;
103    enum RM_status status = remove_entry (fd_cwd, ds, filename, &st, x, NULL);
104    if (status == RM_NONEMPTY_DIR)
105 @@ -1508,6 +1517,8 @@ rm_1 (Dirstack_state *ds, char const *fi
106    ds_clear (ds);
107
108    return status;
109 +  }
110 +  }
111  }
112
113  /* Remove all files and/or directories specified by N_FILES and FILE.
114 @@ -1530,9 +1541,11 @@ rm (size_t n_files, char const *const *f
115         }
116
117        cycle_check_init (&ds->cycle_check_state);
118 +      {
119        enum RM_status s = rm_1 (ds, file[i], x, &cwd_errno);
120        assert (VALID_STATUS (s));
121        UPDATE_STATUS (status, s);
122 +      }
123      }
124
125    if (x->require_restore_cwd && cwd_errno)
126 Index: src/rm.c
127 ===================================================================
128 RCS file: /fetish/cu/src/rm.c,v
129 retrieving revision 1.140
130 diff -u -p -u -r1.140 rm.c
131 --- src/rm.c    3 Sep 2006 02:53:58 -0000       1.140
132 +++ src/rm.c    6 Sep 2006 18:57:46 -0000
133 @@ -369,8 +369,10 @@ main (int argc, char **argv)
134         if (!yesno ())
135           exit (EXIT_SUCCESS);
136        }
137 +   {
138      enum RM_status status = rm (n_files, file, &x);
139      assert (VALID_STATUS (status));
140      exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS);
141 +   }
142    }
143  }
144 Index: shred.c
145 ===================================================================
146 RCS file: /fetish/cu/src/shred.c,v
147 retrieving revision 1.130
148 diff -u -p -r1.130 shred.c
149 --- shred.c     3 Sep 2006 02:53:16 -0000       1.130
150 +++ shred.c     3 Oct 2006 13:48:24 -0000
151 @@ -460,7 +460,7 @@ dopass (int fd, char const *qname, off_t
152                      out.  Thus, it shouldn't give up on bad blocks.  This
153                      code works because lim is always a multiple of
154                      SECTOR_SIZE, except at the end.  */
155 -                 verify (sizeof r % SECTOR_SIZE == 0);
156 +                 { verify (sizeof r % SECTOR_SIZE == 0); }
157                   if (errnum == EIO && 0 <= size && (soff | SECTOR_MASK) < lim)
158                     {
159                       size_t soff1 = (soff | SECTOR_MASK) + 1;