@matheusbsbs / matheus-bagliano / commits / 065027ee1a
Fork 0

string-list: note in docs that callers can specify sorting function

In commit 1959bf6430 (string_list API: document what "sorted" means, 2012-09-17), Documentation/technical/api-string-list.txt was updated to specify that strcmp() was used for sorting. In commit 8dd5afc926 (string-list: allow case-insensitive string list, 2013-01-07), a cmp member was added to struct string_list to allow callers to specify an alternative comparison function, but api-string-list.txt was not updated. In commit 4f665f2cf3 (string-list.h: move documentation from Documentation/api/ into header, 2017-09-26), the now out-dated api-string-list.txt documentation was moved into string-list.h. Update the docs to reflect the configurability of sorting. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Jan 7, 2020 at 15:07 UTC 065027ee1a7b3ecc45b6d331983d38642835c451
1 file changed +4 -2
string-list.h
+4 -2
@@ -4,7 +4,8 @@
4 /**
5 * The string_list API offers a data structure and functions to handle
6 * sorted and unsorted arrays of strings. A "sorted" list is one whose
7 - * entries are sorted by string value in `strcmp()` order.
7 + * entries are sorted by string value in the order specified by the `cmp`
8 + * member (`strcmp()` by default).
9 *
10 * The caller:
11 *
@@ -209,7 +210,8 @@ struct string_list_item *string_list_append(struct string_list *list, const char
210 struct string_list_item *string_list_append_nodup(struct string_list *list, char *string);
211
212 /**
212 - * Sort the list's entries by string value in `strcmp()` order.
213 + * Sort the list's entries by string value in order specified by list->cmp
214 + * (strcmp() if list->cmp is NULL).
215 */
216 void string_list_sort(struct string_list *list);
217