зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
cb944f6b50
Коммит
b684e97736
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
6
notes.c
6
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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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++)
|
||||
|
|
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче