@matheusbsbs / matheus-bagliano / commits / 1843d8d545
Fork 0

cleanup unpack-trees.c: shrink struct tree_entry_list

Remove the two write-only fields executable and symlink from struct tree_entry_list. Also replace usage of the field directory with S_ISDIR checks on the mode field, and then remove this now obsolete field, too. Noticed by David Kastrup. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Jul 24, 2007 at 23:54 UTC 1843d8d545de0e94dc4c7d3c9125fb47a99962c4
1 file changed +3 -9
unpack-trees.c
+3 -9
@@ -11,9 +11,6 @@
11
12 struct tree_entry_list {
13 struct tree_entry_list *next;
14 - unsigned directory : 1;
15 - unsigned executable : 1;
16 - unsigned symlink : 1;
14 unsigned int mode;
15 const char *name;
16 const unsigned char *sha1;
@@ -38,9 +35,6 @@ static struct tree_entry_list *create_tree_entry_list(struct tree *tree)
35 entry->name = one.path;
36 entry->sha1 = one.sha1;
37 entry->mode = one.mode;
41 - entry->directory = S_ISDIR(one.mode) != 0;
42 - entry->executable = (one.mode & S_IXUSR) != 0;
43 - entry->symlink = S_ISLNK(one.mode) != 0;
38 entry->next = NULL;
39
40 *list_p = entry;
@@ -141,9 +135,9 @@ static int unpack_trees_rec(struct tree_entry_list **posns, int len,
135 #endif
136 if (!first || entcmp(first, firstdir,
137 posns[i]->name,
144 - posns[i]->directory) > 0) {
138 + S_ISDIR(posns[i]->mode)) > 0) {
139 first = posns[i]->name;
146 - firstdir = posns[i]->directory;
140 + firstdir = S_ISDIR(posns[i]->mode);
141 }
142 }
143 /* No name means we're done */
@@ -177,7 +171,7 @@ static int unpack_trees_rec(struct tree_entry_list **posns, int len,
171 continue;
172 }
173
180 - if (posns[i]->directory) {
174 + if (S_ISDIR(posns[i]->mode)) {
175 struct tree *tree = lookup_tree(posns[i]->sha1);
176 any_dirs = 1;
177 parse_tree(tree);