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>
Michael Haggerty committed
Nov 25, 2014 at 09:02 UTC
3383e199847485fedf83d0fa38bbd5363074093a
11 files changed
+20
-20
Documentation/technical/api-string-list.txt
+2
-2
@@ -29,7 +29,7 @@ member (you need this if you add things later) and you should set the
29
`unsorted_string_list_has_string` and get it from the list using
30
`string_list_lookup` for sorted lists.
31
32
-. Can sort an unsorted list using `sort_string_list`.
32
+. Can sort an unsorted list using `string_list_sort`.
33
34
. Can remove duplicate items from a sorted list using
35
`string_list_remove_duplicates`.
@@ -146,7 +146,7 @@ write `string_list_insert(...)->util = ...;`.
146
ownership of a malloc()ed string to a `string_list` that has
147
`strdup_string` set.
148
149
-`sort_string_list`::
149
+`string_list_sort`::
150
151
Sort the list's entries by string value in `strcmp()` order.
152
builtin/apply.c
+1
-1
@@ -4180,7 +4180,7 @@ static int write_out_results(struct patch *list)
4180
if (cpath.nr) {
4181
struct string_list_item *item;
4182
4183
- sort_string_list(&cpath);
4183
+ string_list_sort(&cpath);
4184
for_each_string_list_item(item, &cpath)
4185
fprintf(stderr, "U %s\n", item->string);
4186
string_list_clear(&cpath, 0);
builtin/receive-pack.c
+1
-1
@@ -964,7 +964,7 @@ static void check_aliased_updates(struct command *commands)
964
string_list_append(&ref_list, cmd->ref_name);
965
item->util = (void *)cmd;
966
}
967
- sort_string_list(&ref_list);
967
+ string_list_sort(&ref_list);
968
969
for (cmd = commands; cmd; cmd = cmd->next) {
970
if (!cmd->error_string)
builtin/remote.c
+6
-6
@@ -352,9 +352,9 @@ static int get_ref_states(const struct ref *remote_refs, struct ref_states *stat
352
free_refs(stale_refs);
353
free_refs(fetch_map);
354
355
- sort_string_list(&states->new);
356
- sort_string_list(&states->tracked);
357
- sort_string_list(&states->stale);
355
+ string_list_sort(&states->new);
356
+ string_list_sort(&states->tracked);
357
+ string_list_sort(&states->stale);
358
359
return 0;
360
}
@@ -909,7 +909,7 @@ static int get_remote_ref_states(const char *name,
909
get_push_ref_states(remote_refs, states);
910
} else {
911
for_each_ref(append_ref_to_tracked_list, states);
912
- sort_string_list(&states->tracked);
912
+ string_list_sort(&states->tracked);
913
get_push_ref_states_noquery(states);
914
}
915
@@ -1128,7 +1128,7 @@ static int show_all(void)
1128
if (!result) {
1129
int i;
1130
1131
- sort_string_list(&list);
1131
+ string_list_sort(&list);
1132
for (i = 0; i < list.nr; i++) {
1133
struct string_list_item *item = list.items + i;
1134
if (verbose)
@@ -1333,7 +1333,7 @@ static int prune_remote(const char *remote, int dry_run)
1333
1334
for_each_string_list_item(item, &states.stale)
1335
string_list_append(&refs_to_prune, item->util);
1336
- sort_string_list(&refs_to_prune);
1336
+ string_list_sort(&refs_to_prune);
1337
1338
if (!dry_run) {
1339
struct strbuf err = STRBUF_INIT;
builtin/repack.c
+1
-1
@@ -379,7 +379,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
379
380
if (delete_redundant) {
381
int opts = 0;
382
- sort_string_list(&names);
382
+ string_list_sort(&names);
383
for_each_string_list_item(item, &existing_packs) {
384
char *sha1;
385
size_t len = strlen(item->string);
connect.c
+1
-1
@@ -93,7 +93,7 @@ static void annotate_refs_with_symref_info(struct ref *ref)
93
parse_one_symref_info(&symref, val, len);
94
feature_list = val + 1;
95
}
96
- sort_string_list(&symref);
96
+ string_list_sort(&symref);
97
98
for (; ref; ref = ref->next) {
99
struct string_list_item *item;
notes.c
+1
-1
@@ -902,7 +902,7 @@ int combine_notes_cat_sort_uniq(unsigned char *cur_sha1,
902
if (string_list_add_note_lines(&sort_uniq_list, new_sha1))
903
goto out;
904
string_list_remove_empty_items(&sort_uniq_list, 0);
905
- sort_string_list(&sort_uniq_list);
905
+ string_list_sort(&sort_uniq_list);
906
string_list_remove_duplicates(&sort_uniq_list, 0);
907
908
/* create a new blob object from sort_uniq_list */
remote.c
+3
-3
@@ -1356,7 +1356,7 @@ static void add_missing_tags(struct ref *src, struct ref **dst, struct ref ***ds
1356
}
1357
clear_commit_marks_many(sent_tips.nr, sent_tips.tip, TMP_MARK);
1358
1359
- sort_string_list(&dst_tag);
1359
+ string_list_sort(&dst_tag);
1360
1361
/* Collect tags they do not have. */
1362
for (ref = src; ref; ref = ref->next) {
@@ -1421,7 +1421,7 @@ static void prepare_ref_index(struct string_list *ref_index, struct ref *ref)
1421
for ( ; ref; ref = ref->next)
1422
string_list_append_nodup(ref_index, ref->name)->util = ref;
1423
1424
- sort_string_list(ref_index);
1424
+ string_list_sort(ref_index);
1425
}
1426
1427
/*
@@ -2135,7 +2135,7 @@ struct ref *get_stale_heads(struct refspec *refs, int ref_count, struct ref *fet
2135
info.ref_count = ref_count;
2136
for (ref = fetch_map; ref; ref = ref->next)
2137
string_list_append(&ref_names, ref->name);
2138
- sort_string_list(&ref_names);
2138
+ string_list_sort(&ref_names);
2139
for_each_ref(get_stale_heads_cb, &info);
2140
string_list_clear(&ref_names, 0);
2141
return stale_refs;
sha1_file.c
+1
-1
@@ -1198,7 +1198,7 @@ static void report_pack_garbage(struct string_list *list)
1198
if (!report_garbage)
1199
return;
1200
1201
- sort_string_list(list);
1201
+ string_list_sort(list);
1202
1203
for (i = 0; i < list->nr; i++) {
1204
const char *path = list->items[i].string;
string-list.c
+2
-2
@@ -220,7 +220,7 @@ struct string_list_item *string_list_append(struct string_list *list,
220
/* Yuck */
221
static compare_strings_fn compare_for_qsort;
222
223
-/* Only call this from inside sort_string_list! */
223
+/* Only call this from inside string_list_sort! */
224
static int cmp_items(const void *a, const void *b)
225
{
226
const struct string_list_item *one = a;
@@ -228,7 +228,7 @@ static int cmp_items(const void *a, const void *b)
228
return compare_for_qsort(one->string, two->string);
229
}
230
231
-void sort_string_list(struct string_list *list)
231
+void string_list_sort(struct string_list *list)
232
{
233
compare_for_qsort = list->cmp ? list->cmp : strcmp;
234
qsort(list->items, list->nr, sizeof(*list->items), cmp_items);
string-list.h
+1
-1
@@ -85,7 +85,7 @@ struct string_list_item *string_list_append(struct string_list *list, const char
85
*/
86
struct string_list_item *string_list_append_nodup(struct string_list *list, char *string);
87
88
-void sort_string_list(struct string_list *list);
88
+void string_list_sort(struct string_list *list);
89
int unsorted_string_list_has_string(struct string_list *list, const char *string);
90
struct string_list_item *unsorted_string_list_lookup(struct string_list *list,
91
const char *string);