annotate lib/fts-cycle.c @ 17463:203c036eb0c6

bootstrap: support checksum utils without a --status option * build-aux/bootstrap: Only look for sha1sum if updating po files. Add sha1 to the list of supported checksum utils since it's now supported through adjustments below. (update_po_files): Remove the use of --status in a way that will suppress all error messages, but since this is only used to minimize updates, it shouldn't cause an issue. Exit early if there is a problem updating the po file checksums. (find_tool): Remove the check for --version support as this is optional as per commit 86186b17. Don't even check for the presence of the command as if that is needed, it's supported through configuring prerequisites in bootstrap.conf. Prompt that when a tool isn't found, one can define an environment variable to add to the hardcoded search list.
author Pádraig Brady <P@draigBrady.com>
date Thu, 08 Aug 2013 11:08:49 +0100 (2013-08-08)
parents e542fd46ad6f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
1 /* Detect cycles in file tree walks.
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
2
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16201
diff changeset
3 Copyright (C) 2003-2006, 2009-2013 Free Software Foundation, Inc.
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
4
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
5 Written by Jim Meyering.
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
6
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7459
diff changeset
7 This program is free software: you can redistribute it and/or modify
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7459
diff changeset
9 the Free Software Foundation; either version 3 of the License, or
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7459
diff changeset
10 (at your option) any later version.
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
11
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
12 This program is distributed in the hope that it will be useful,
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
15 GNU General Public License for more details.
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
16
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7459
diff changeset
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
19
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
20 #include "cycle-check.h"
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
21 #include "hash.h"
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
22
5907
c47674a83a78 Sync from coreutils.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5872
diff changeset
23 /* Use each of these to map a device/inode pair to an FTSENT. */
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
24 struct Active_dir
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
25 {
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
26 dev_t dev;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
27 ino_t ino;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
28 FTSENT *fts_ent;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
29 };
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
30
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
31 static bool
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
32 AD_compare (void const *x, void const *y)
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
33 {
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
34 struct Active_dir const *ax = x;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
35 struct Active_dir const *ay = y;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
36 return ax->ino == ay->ino
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
37 && ax->dev == ay->dev;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
38 }
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
39
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
40 static size_t
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
41 AD_hash (void const *x, size_t table_size)
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
42 {
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
43 struct Active_dir const *ax = x;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
44 return (uintmax_t) ax->ino % table_size;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
45 }
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
46
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
47 /* Set up the cycle-detection machinery. */
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
48
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
49 static bool
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
50 setup_dir (FTS *fts)
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
51 {
6036
14b1cca449ad (setup_dir, enter_dir, leave_dir, free_dir):
Jim Meyering <jim@meyering.net>
parents: 5907
diff changeset
52 if (fts->fts_options & (FTS_TIGHT_CYCLE_CHECK | FTS_LOGICAL))
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
53 {
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
54 enum { HT_INITIAL_SIZE = 31 };
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
55 fts->fts_cycle.ht = hash_initialize (HT_INITIAL_SIZE, NULL, AD_hash,
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
56 AD_compare, free);
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
57 if (! fts->fts_cycle.ht)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
58 return false;
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
59 }
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
60 else
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
61 {
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
62 fts->fts_cycle.state = malloc (sizeof *fts->fts_cycle.state);
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
63 if (! fts->fts_cycle.state)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
64 return false;
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
65 cycle_check_init (fts->fts_cycle.state);
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
66 }
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
67
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
68 return true;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
69 }
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
70
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
71 /* Enter a directory during a file tree walk. */
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
72
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
73 static bool
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
74 enter_dir (FTS *fts, FTSENT *ent)
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
75 {
6036
14b1cca449ad (setup_dir, enter_dir, leave_dir, free_dir):
Jim Meyering <jim@meyering.net>
parents: 5907
diff changeset
76 if (fts->fts_options & (FTS_TIGHT_CYCLE_CHECK | FTS_LOGICAL))
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
77 {
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
78 struct stat const *st = ent->fts_statp;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
79 struct Active_dir *ad = malloc (sizeof *ad);
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
80 struct Active_dir *ad_from_table;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
81
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
82 if (!ad)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
83 return false;
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
84
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
85 ad->dev = st->st_dev;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
86 ad->ino = st->st_ino;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
87 ad->fts_ent = ent;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
88
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
89 /* See if we've already encountered this directory.
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
90 This can happen when following symlinks as well as
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
91 with a corrupted directory hierarchy. */
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
92 ad_from_table = hash_insert (fts->fts_cycle.ht, ad);
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
93
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
94 if (ad_from_table != ad)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
95 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
96 free (ad);
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
97 if (!ad_from_table)
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
98 return false;
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
99
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
100 /* There was an entry with matching dev/inode already in the table.
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
101 Record the fact that we've found a cycle. */
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
102 ent->fts_cycle = ad_from_table->fts_ent;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
103 ent->fts_info = FTS_DC;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
104 }
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
105 }
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
106 else
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
107 {
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
108 if (cycle_check (fts->fts_cycle.state, ent->fts_statp))
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
109 {
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
110 /* FIXME: setting fts_cycle like this isn't proper.
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
111 To do what the documentation requires, we'd have to
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
112 go around the cycle again and find the right entry.
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
113 But no callers in coreutils use the fts_cycle member. */
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
114 ent->fts_cycle = ent;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
115 ent->fts_info = FTS_DC;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
116 }
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
117 }
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
118
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
119 return true;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
120 }
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
121
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
122 /* Leave a directory during a file tree walk. */
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
123
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
124 static void
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
125 leave_dir (FTS *fts, FTSENT *ent)
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
126 {
6912
314715e0260d Merge from coreutils.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6322
diff changeset
127 struct stat const *st = ent->fts_statp;
6036
14b1cca449ad (setup_dir, enter_dir, leave_dir, free_dir):
Jim Meyering <jim@meyering.net>
parents: 5907
diff changeset
128 if (fts->fts_options & (FTS_TIGHT_CYCLE_CHECK | FTS_LOGICAL))
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
129 {
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
130 struct Active_dir obj;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
131 void *found;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
132 obj.dev = st->st_dev;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
133 obj.ino = st->st_ino;
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
134 found = hash_delete (fts->fts_cycle.ht, &obj);
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
135 if (!found)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
136 abort ();
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
137 free (found);
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
138 }
6912
314715e0260d Merge from coreutils.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6322
diff changeset
139 else
314715e0260d Merge from coreutils.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6322
diff changeset
140 {
314715e0260d Merge from coreutils.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6322
diff changeset
141 FTSENT *parent = ent->fts_parent;
7459
ed1c08123d81 * fts-cycle.c (leave_dir): When "leaving" a top level directory due
Jim Meyering <jim@meyering.net>
parents: 7455
diff changeset
142 if (parent != NULL && 0 <= parent->fts_level)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
143 CYCLE_CHECK_REFLECT_CHDIR_UP (fts->fts_cycle.state,
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
144 *(parent->fts_statp), *st);
6912
314715e0260d Merge from coreutils.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6322
diff changeset
145 }
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
146 }
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
147
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
148 /* Free any memory used for cycle detection. */
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
149
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
150 static void
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
151 free_dir (FTS *sp)
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
152 {
6036
14b1cca449ad (setup_dir, enter_dir, leave_dir, free_dir):
Jim Meyering <jim@meyering.net>
parents: 5907
diff changeset
153 if (sp->fts_options & (FTS_TIGHT_CYCLE_CHECK | FTS_LOGICAL))
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
154 {
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
155 if (sp->fts_cycle.ht)
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 9309
diff changeset
156 hash_free (sp->fts_cycle.ht);
5872
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
157 }
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
158 else
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
159 free (sp->fts_cycle.state);
fab6701e5cb2 New fts module.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
160 }