summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cb944f6)
raw | patch | inline | side by side (parent: cb944f6)
author | Julian Phillips <julian@quantumfyre.co.uk> | |
Fri, 25 Jun 2010 23:41:34 +0000 (00:41 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 27 Jun 2010 17:06:51 +0000 (10:06 -0700) |
Update the definition and callers of for_each_string_list to use the
string_list as the first argument. This helps make the string_list
API easier to use by being more consistent.
Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
string_list as the first argument. This helps make the string_list
API easier to use by being more consistent.
Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c | patch | blob | history | |
builtin/ls-files.c | patch | blob | history | |
builtin/remote.c | patch | blob | history | |
notes.c | patch | blob | history | |
resolve-undo.c | patch | blob | history | |
string-list.c | patch | blob | history | |
string-list.h | patch | blob | history |
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 8470850415c14cad8ceeca9f6baef46ab6feabc3..b040e5a31d417d39a1cd9520dfd6b71ebf2f75a3 100644 (file)
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
* For all the tags in the remote_refs string list, call
* add_to_tail to add them to the list of refs to be fetched
*/
- for_each_string_list(add_to_tail, &remote_refs, &data);
+ for_each_string_list(&remote_refs, add_to_tail, &data);
string_list_clear(&remote_refs, 0);
}
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index c0fbcdcf4f3447c29c4058907ea2e25fa6d225a6..3eeacdc6999249983e68add8a6c5745df90c647b 100644 (file)
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
{
if (!the_index.resolve_undo)
return;
- for_each_string_list(show_one_ru, the_index.resolve_undo, NULL);
+ for_each_string_list(the_index.resolve_undo, show_one_ru, NULL);
}
static void show_files(struct dir_struct *dir, const char *prefix)
diff --git a/builtin/remote.c b/builtin/remote.c
index 0e99a9957dad39ded17ce98de49b164fdb70eacd..67a3b4ac43d3347534b7e8b91ed0e62015363de6 100644 (file)
--- a/builtin/remote.c
+++ b/builtin/remote.c
/* remote branch info */
info.width = 0;
- for_each_string_list(add_remote_to_show_info, &states.new, &info);
- for_each_string_list(add_remote_to_show_info, &states.tracked, &info);
- for_each_string_list(add_remote_to_show_info, &states.stale, &info);
+ for_each_string_list(&states.new, add_remote_to_show_info, &info);
+ for_each_string_list(&states.tracked, add_remote_to_show_info, &info);
+ for_each_string_list(&states.stale, add_remote_to_show_info, &info);
if (info.list->nr)
printf(" Remote branch%s:%s\n",
info.list->nr > 1 ? "es" : "",
no_query ? " (status not queried)" : "");
- for_each_string_list(show_remote_info_item, info.list, &info);
+ for_each_string_list(info.list, show_remote_info_item, &info);
string_list_clear(info.list, 0);
/* git pull info */
info.width = 0;
info.any_rebase = 0;
- for_each_string_list(add_local_to_show_info, &branch_list, &info);
+ for_each_string_list(&branch_list, add_local_to_show_info, &info);
if (info.list->nr)
printf(" Local branch%s configured for 'git pull':\n",
info.list->nr > 1 ? "es" : "");
- for_each_string_list(show_local_info_item, info.list, &info);
+ for_each_string_list(info.list, show_local_info_item, &info);
string_list_clear(info.list, 0);
/* git push info */
printf(" Local refs will be mirrored by 'git push'\n");
info.width = info.width2 = 0;
- for_each_string_list(add_push_to_show_info, &states.push, &info);
+ for_each_string_list(&states.push, add_push_to_show_info, &info);
qsort(info.list->items, info.list->nr,
sizeof(*info.list->items), cmp_string_with_push);
if (info.list->nr)
printf(" Local ref%s configured for 'git push'%s:\n",
info.list->nr > 1 ? "s" : "",
no_query ? " (status not queried)" : "");
- for_each_string_list(show_push_info_item, info.list, &info);
+ for_each_string_list(info.list, show_push_info_item, &info);
string_list_clear(info.list, 0);
free_remote_ref_states(&states);
index e425e198278bfb5c6a039dc88825568f1518e875..70170db918c0f3e0d4af22bf6559008ed2b961f7 100644 (file)
--- a/notes.c
+++ b/notes.c
trees = xmalloc((refs->nr+1) * sizeof(struct notes_tree *));
cb_data.counter = 0;
cb_data.trees = trees;
- for_each_string_list(load_one_display_note_ref, refs, &cb_data);
+ for_each_string_list(refs, load_one_display_note_ref, &cb_data);
trees[cb_data.counter] = NULL;
return trees;
}
git_config(notes_display_config, &load_config_refs);
if (opt && opt->extra_notes_refs)
- for_each_string_list(string_list_add_refs_from_list,
- opt->extra_notes_refs,
+ for_each_string_list(opt->extra_notes_refs,
+ string_list_add_refs_from_list,
&display_notes_refs);
display_notes_trees = load_notes_trees(&display_notes_refs);
diff --git a/resolve-undo.c b/resolve-undo.c
index 0f50ee0484776c545e632cde69b0646629a3b190..e93b3d1b530e878245ac68d76230e028d596d4a7 100644 (file)
--- a/resolve-undo.c
+++ b/resolve-undo.c
void resolve_undo_write(struct strbuf *sb, struct string_list *resolve_undo)
{
- for_each_string_list(write_one, resolve_undo, sb);
+ for_each_string_list(resolve_undo, write_one, sb);
}
struct string_list *resolve_undo_read(const char *data, unsigned long size)
diff --git a/string-list.c b/string-list.c
index b7e57a407c351e6e39cd86884f64cee7d582b4f1..09798a2dc8277286454998e74297e868b9345857 100644 (file)
--- a/string-list.c
+++ b/string-list.c
return list->items + i;
}
-int for_each_string_list(string_list_each_func_t fn,
- struct string_list *list, void *cb_data)
+int for_each_string_list(struct string_list *list,
+ string_list_each_func_t fn, void *cb_data)
{
int i, ret = 0;
for (i = 0; i < list->nr; i++)
diff --git a/string-list.h b/string-list.h
index de29dcd96eae97a5d032b669b67e6715580fea12..1e2dfc3453ec786bc38fcbacec63e4bb5f058e44 100644 (file)
--- a/string-list.h
+++ b/string-list.h
/* Use this function to iterate over each item */
typedef int (*string_list_each_func_t)(struct string_list_item *, void *);
-int for_each_string_list(string_list_each_func_t,
- struct string_list *list, void *cb_data);
+int for_each_string_list(struct string_list *list,
+ string_list_each_func_t, void *cb_data);
/* Use these functions only on sorted lists: */
int string_list_has_string(const struct string_list *list, const char *string);