Improve the check for departures from C89, and fix the departures
[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 --git a/src/remove.c b/src/remove.c
6 index 4728bdd..7477da5 100644
7 --- a/src/remove.c
8 +++ b/src/remove.c
9 @@ -236,9 +236,10 @@ pop_dir (Dirstack_state *ds)
10  {
11    size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t);
12    size_t *length = obstack_base (&ds->len_stack);
13 +  size_t top_len;
14
15    assert (n_lengths > 0);
16 -  size_t top_len = length[n_lengths - 1];
17 +  top_len = length[n_lengths - 1];
18    assert (top_len >= 2);
19
20    /* Pop the specified length of file name.  */
21 @@ -370,10 +371,11 @@ AD_stack_top (Dirstack_state const *ds)
22  static void
23  AD_stack_pop (Dirstack_state *ds)
24  {
25 +  struct AD_ent *top;
26    assert (0 < AD_stack_height (ds));
27
28    /* operate on Active_dir.  pop and free top entry */
29 -  struct AD_ent *top = AD_stack_top (ds);
30 +  top = AD_stack_top (ds);
31    if (top->unremovable)
32      hash_free (top->unremovable);
33    obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent));
34 @@ -1463,6 +1465,7 @@ rm_1 (Dirstack_state *ds, char const *fi
35        return RM_ERROR;
36      }
37
38 +  {
39    struct stat st;
40    cache_stat_init (&st);
41    cycle_check_init (&ds->cycle_check_state);
42 @@ -1485,6 +1488,7 @@ rm_1 (Dirstack_state *ds, char const *fi
43    AD_push_initial (ds);
44    AD_INIT_OTHER_MEMBERS ();
45
46 +  {
47    enum RM_status status = remove_entry (AT_FDCWD, ds, filename, &st, x, NULL);
48    if (status == RM_NONEMPTY_DIR)
49      {
50 @@ -1501,6 +1505,8 @@ rm_1 (Dirstack_state *ds, char const *fi
51
52    ds_clear (ds);
53    return status;
54 +  }
55 +  }
56  }
57
58  /* Remove all files and/or directories specified by N_FILES and FILE.
59 Index: src/rm.c
60 ===================================================================
61 RCS file: /fetish/cu/src/rm.c,v
62 retrieving revision 1.140
63 diff --git a/src/rm.c b/src/rm.c
64 index 364a21c..7a24014 100644
65 --- a/src/rm.c
66 +++ b/src/rm.c
67 @@ -355,6 +355,7 @@ main (int argc, char **argv)
68                quote ("/"));
69      }
70
71 +  {
72    size_t n_files = argc - optind;
73    char const *const *file = (char const *const *) argv + optind;
74
75 @@ -368,7 +369,10 @@ main (int argc, char **argv)
76        if (!yesno ())
77         exit (EXIT_SUCCESS);
78      }
79 +  {
80    enum RM_status status = rm (n_files, file, &x);
81    assert (VALID_STATUS (status));
82    exit (status == RM_ERROR ? EXIT_FAILURE : EXIT_SUCCESS);
83 +  }
84 +  }
85  }
86 Index: shred.c
87 ===================================================================
88 RCS file: /fetish/cu/src/shred.c,v
89 retrieving revision 1.130
90 diff -u -p -r1.130 shred.c
91 --- shred.c     3 Sep 2006 02:53:16 -0000       1.130
92 +++ shred.c     3 Oct 2006 13:48:24 -0000
93 @@ -460,7 +460,7 @@ dopass (int fd, char const *qname, off_t
94                      out.  Thus, it shouldn't give up on bad blocks.  This
95                      code works because lim is always a multiple of
96                      SECTOR_SIZE, except at the end.  */
97 -                 verify (sizeof r % SECTOR_SIZE == 0);
98 +                 { verify (sizeof r % SECTOR_SIZE == 0); }
99                   if (errnum == EIO && 0 <= size && (soff | SECTOR_MASK) < lim)
100                     {
101                       size_t soff1 = (soff | SECTOR_MASK) + 1;