summaryrefslogtreecommitdiff
path: root/builtin/ls-files.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-08-18 19:14:38 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-08-18 19:14:38 (GMT)
commitc7e375de4228cdb86e2582e2eda7fa3a6f352fc2 (patch)
tree31cb1ae05dd6621c740080e6195d16a78e7a215f /builtin/ls-files.c
parentd425aa5cac0b4124c6aa5520295e0fd5ed81780b (diff)
parent8a57c6e9437eeebf849f0def03389078a510312e (diff)
downloadgit-c7e375de4228cdb86e2582e2eda7fa3a6f352fc2.zip
git-c7e375de4228cdb86e2582e2eda7fa3a6f352fc2.tar.gz
git-c7e375de4228cdb86e2582e2eda7fa3a6f352fc2.tar.bz2
Merge branch 'ar/string-list-foreach'
* ar/string-list-foreach: Convert the users of for_each_string_list to for_each_string_list_item macro Add a for_each_string_list_item macro
Diffstat (limited to 'builtin/ls-files.c')
-rw-r--r--builtin/ls-files.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index cc202c5..bb4f612 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -172,33 +172,32 @@ static void show_ce_entry(const char *tag, struct cache_entry *ce)
}
}
-static int show_one_ru(struct string_list_item *item, void *cbdata)
-{
- const char *path = item->string;
- struct resolve_undo_info *ui = item->util;
- int i, len;
-
- len = strlen(path);
- if (len < max_prefix_len)
- return 0; /* outside of the prefix */
- if (!match_pathspec(pathspec, path, len, max_prefix_len, ps_matched))
- return 0; /* uninterested */
- for (i = 0; i < 3; i++) {
- if (!ui->mode[i])
- continue;
- printf("%s%06o %s %d\t", tag_resolve_undo, ui->mode[i],
- find_unique_abbrev(ui->sha1[i], abbrev),
- i + 1);
- write_name(path, len);
- }
- return 0;
-}
-
static void show_ru_info(void)
{
+ struct string_list_item *item;
+
if (!the_index.resolve_undo)
return;
- for_each_string_list(the_index.resolve_undo, show_one_ru, NULL);
+
+ for_each_string_list_item(item, the_index.resolve_undo) {
+ const char *path = item->string;
+ struct resolve_undo_info *ui = item->util;
+ int i, len;
+
+ len = strlen(path);
+ if (len < max_prefix_len)
+ continue; /* outside of the prefix */
+ if (!match_pathspec(pathspec, path, len, max_prefix_len, ps_matched))
+ continue; /* uninterested */
+ for (i = 0; i < 3; i++) {
+ if (!ui->mode[i])
+ continue;
+ printf("%s%06o %s %d\t", tag_resolve_undo, ui->mode[i],
+ find_unique_abbrev(ui->sha1[i], abbrev),
+ i + 1);
+ write_name(path, len);
+ }
+ }
}
static void show_files(struct dir_struct *dir)