sort_string_list(): rename to string_list_sort()
The new name is more consistent with the names of other string_list-related functions. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
8552943f41
commit
3383e19984
@ -29,7 +29,7 @@ member (you need this if you add things later) and you should set the
|
||||
`unsorted_string_list_has_string` and get it from the list using
|
||||
`string_list_lookup` for sorted lists.
|
||||
|
||||
. Can sort an unsorted list using `sort_string_list`.
|
||||
. Can sort an unsorted list using `string_list_sort`.
|
||||
|
||||
. Can remove duplicate items from a sorted list using
|
||||
`string_list_remove_duplicates`.
|
||||
@ -146,7 +146,7 @@ write `string_list_insert(...)->util = ...;`.
|
||||
ownership of a malloc()ed string to a `string_list` that has
|
||||
`strdup_string` set.
|
||||
|
||||
`sort_string_list`::
|
||||
`string_list_sort`::
|
||||
|
||||
Sort the list's entries by string value in `strcmp()` order.
|
||||
|
||||
|
@ -4180,7 +4180,7 @@ static int write_out_results(struct patch *list)
|
||||
if (cpath.nr) {
|
||||
struct string_list_item *item;
|
||||
|
||||
sort_string_list(&cpath);
|
||||
string_list_sort(&cpath);
|
||||
for_each_string_list_item(item, &cpath)
|
||||
fprintf(stderr, "U %s\n", item->string);
|
||||
string_list_clear(&cpath, 0);
|
||||
|
@ -964,7 +964,7 @@ static void check_aliased_updates(struct command *commands)
|
||||
string_list_append(&ref_list, cmd->ref_name);
|
||||
item->util = (void *)cmd;
|
||||
}
|
||||
sort_string_list(&ref_list);
|
||||
string_list_sort(&ref_list);
|
||||
|
||||
for (cmd = commands; cmd; cmd = cmd->next) {
|
||||
if (!cmd->error_string)
|
||||
|
@ -352,9 +352,9 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
|
||||
free_refs(stale_refs);
|
||||
free_refs(fetch_map);
|
||||
|
||||
sort_string_list(&states->new);
|
||||
sort_string_list(&states->tracked);
|
||||
sort_string_list(&states->stale);
|
||||
string_list_sort(&states->new);
|
||||
string_list_sort(&states->tracked);
|
||||
string_list_sort(&states->stale);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -909,7 +909,7 @@ static int get_remote_ref_states(const char *name,
|
||||
get_push_ref_states(remote_refs, states);
|
||||
} else {
|
||||
for_each_ref(append_ref_to_tracked_list, states);
|
||||
sort_string_list(&states->tracked);
|
||||
string_list_sort(&states->tracked);
|
||||
get_push_ref_states_noquery(states);
|
||||
}
|
||||
|
||||
@ -1128,7 +1128,7 @@ static int show_all(void)
|
||||
if (!result) {
|
||||
int i;
|
||||
|
||||
sort_string_list(&list);
|
||||
string_list_sort(&list);
|
||||
for (i = 0; i < list.nr; i++) {
|
||||
struct string_list_item *item = list.items + i;
|
||||
if (verbose)
|
||||
@ -1333,7 +1333,7 @@ static int prune_remote(const char *remote, int dry_run)
|
||||
|
||||
for_each_string_list_item(item, &states.stale)
|
||||
string_list_append(&refs_to_prune, item->util);
|
||||
sort_string_list(&refs_to_prune);
|
||||
string_list_sort(&refs_to_prune);
|
||||
|
||||
if (!dry_run) {
|
||||
struct strbuf err = STRBUF_INIT;
|
||||
|
@ -379,7 +379,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
|
||||
|
||||
if (delete_redundant) {
|
||||
int opts = 0;
|
||||
sort_string_list(&names);
|
||||
string_list_sort(&names);
|
||||
for_each_string_list_item(item, &existing_packs) {
|
||||
char *sha1;
|
||||
size_t len = strlen(item->string);
|
||||
|
@ -93,7 +93,7 @@ static void annotate_refs_with_symref_info(struct ref *ref)
|
||||
parse_one_symref_info(&symref, val, len);
|
||||
feature_list = val + 1;
|
||||
}
|
||||
sort_string_list(&symref);
|
||||
string_list_sort(&symref);
|
||||
|
||||
for (; ref; ref = ref->next) {
|
||||
struct string_list_item *item;
|
||||
|
2
notes.c
2
notes.c
@ -902,7 +902,7 @@ int combine_notes_cat_sort_uniq(unsigned char *cur_sha1,
|
||||
if (string_list_add_note_lines(&sort_uniq_list, new_sha1))
|
||||
goto out;
|
||||
string_list_remove_empty_items(&sort_uniq_list, 0);
|
||||
sort_string_list(&sort_uniq_list);
|
||||
string_list_sort(&sort_uniq_list);
|
||||
string_list_remove_duplicates(&sort_uniq_list, 0);
|
||||
|
||||
/* create a new blob object from sort_uniq_list */
|
||||
|
6
remote.c
6
remote.c
@ -1356,7 +1356,7 @@ static void add_missing_tags(struct ref *src, struct ref **dst, struct ref ***ds
|
||||
}
|
||||
clear_commit_marks_many(sent_tips.nr, sent_tips.tip, TMP_MARK);
|
||||
|
||||
sort_string_list(&dst_tag);
|
||||
string_list_sort(&dst_tag);
|
||||
|
||||
/* Collect tags they do not have. */
|
||||
for (ref = src; ref; ref = ref->next) {
|
||||
@ -1421,7 +1421,7 @@ static void prepare_ref_index(struct string_list *ref_index, struct ref *ref)
|
||||
for ( ; ref; ref = ref->next)
|
||||
string_list_append_nodup(ref_index, ref->name)->util = ref;
|
||||
|
||||
sort_string_list(ref_index);
|
||||
string_list_sort(ref_index);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2135,7 +2135,7 @@ struct ref *get_stale_heads(struct refspec *refs, int ref_count, struct ref *fet
|
||||
info.ref_count = ref_count;
|
||||
for (ref = fetch_map; ref; ref = ref->next)
|
||||
string_list_append(&ref_names, ref->name);
|
||||
sort_string_list(&ref_names);
|
||||
string_list_sort(&ref_names);
|
||||
for_each_ref(get_stale_heads_cb, &info);
|
||||
string_list_clear(&ref_names, 0);
|
||||
return stale_refs;
|
||||
|
@ -1198,7 +1198,7 @@ static void report_pack_garbage(struct string_list *list)
|
||||
if (!report_garbage)
|
||||
return;
|
||||
|
||||
sort_string_list(list);
|
||||
string_list_sort(list);
|
||||
|
||||
for (i = 0; i < list->nr; i++) {
|
||||
const char *path = list->items[i].string;
|
||||
|
@ -220,7 +220,7 @@ struct string_list_item *string_list_append(struct string_list *list,
|
||||
/* Yuck */
|
||||
static compare_strings_fn compare_for_qsort;
|
||||
|
||||
/* Only call this from inside sort_string_list! */
|
||||
/* Only call this from inside string_list_sort! */
|
||||
static int cmp_items(const void *a, const void *b)
|
||||
{
|
||||
const struct string_list_item *one = a;
|
||||
@ -228,7 +228,7 @@ static int cmp_items(const void *a, const void *b)
|
||||
return compare_for_qsort(one->string, two->string);
|
||||
}
|
||||
|
||||
void sort_string_list(struct string_list *list)
|
||||
void string_list_sort(struct string_list *list)
|
||||
{
|
||||
compare_for_qsort = list->cmp ? list->cmp : strcmp;
|
||||
qsort(list->items, list->nr, sizeof(*list->items), cmp_items);
|
||||
|
@ -85,7 +85,7 @@ struct string_list_item *string_list_append(struct string_list *list, const char
|
||||
*/
|
||||
struct string_list_item *string_list_append_nodup(struct string_list *list, char *string);
|
||||
|
||||
void sort_string_list(struct string_list *list);
|
||||
void string_list_sort(struct string_list *list);
|
||||
int unsorted_string_list_has_string(struct string_list *list, const char *string);
|
||||
struct string_list_item *unsorted_string_list_lookup(struct string_list *list,
|
||||
const char *string);
|
||||
|
Loading…
Reference in New Issue
Block a user