aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Phillips <julian@quantumfyre.co.uk>2010-06-26 00:41:34 +0100
committerJunio C Hamano <gitster@pobox.com>2010-06-27 10:06:51 -0700
commitb684e977363ee5cb53d83c69f2298d7898c5f89a (patch)
treeb5f70daef883213e3f69643113601cc07e872083
parentcb944f6b5009e4788041a5194d73b92a0620c9d9 (diff)
downloadgit-b684e977363ee5cb53d83c69f2298d7898c5f89a.tar.gz
git-b684e977363ee5cb53d83c69f2298d7898c5f89a.tar.xz
string_list: Fix argument order for for_each_string_list
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>
-rw-r--r--builtin/fetch.c2
-rw-r--r--builtin/ls-files.c2
-rw-r--r--builtin/remote.c16
-rw-r--r--notes.c6
-rw-r--r--resolve-undo.c2
-rw-r--r--string-list.c4
-rw-r--r--string-list.h4
7 files changed, 18 insertions, 18 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 847085041..b040e5a31 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -633,7 +633,7 @@ static void find_non_local_tags(struct transport *transport,
* 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 c0fbcdcf4..3eeacdc69 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -186,7 +186,7 @@ static void show_ru_info(const char *prefix)
{
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 0e99a9957..67a3b4ac4 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1081,24 +1081,24 @@ static int show(int argc, const char **argv)
/* 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 */
@@ -1106,14 +1106,14 @@ static int show(int argc, const char **argv)
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);
diff --git a/notes.c b/notes.c
index e425e1982..70170db91 100644
--- a/notes.c
+++ b/notes.c
@@ -969,7 +969,7 @@ struct notes_tree **load_notes_trees(struct string_list *refs)
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;
}
@@ -996,8 +996,8 @@ void init_display_notes(struct display_notes_opt *opt)
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 0f50ee048..e93b3d1b5 100644
--- a/resolve-undo.c
+++ b/resolve-undo.c
@@ -50,7 +50,7 @@ static int write_one(struct string_list_item *item, void *cbdata)
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 b7e57a407..09798a2dc 100644
--- a/string-list.c
+++ b/string-list.c
@@ -92,8 +92,8 @@ struct string_list_item *string_list_lookup(const char *string, struct string_li
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 de29dcd96..1e2dfc345 100644
--- a/string-list.h
+++ b/string-list.h
@@ -22,8 +22,8 @@ void string_list_clear_func(struct string_list *list, string_list_clear_func_t c
/* 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);