git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] string-list: note in docs that callers can specify sorting function
@ 2020-01-07 15:07 Elijah Newren via GitGitGadget
  2020-01-07 15:07 ` [PATCH 1/1] " Elijah Newren via GitGitGadget
  0 siblings, 1 reply; 2+ messages in thread
From: Elijah Newren via GitGitGadget @ 2020-01-07 15:07 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Simple change to the string-list docs to reflect the fact that string-list
now has a cmp member field these days that can be set to something other
than strcmp().

Elijah Newren (1):
  string-list: note in docs that callers can specify sorting function

 string-list.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)


base-commit: 8679ef24ed64018bb62170c43ce73e0261c0600a
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-689%2Fnewren%2Fstring-list-update-docs-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-689/newren/string-list-update-docs-v1
Pull-Request: https://github.com/git/git/pull/689
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] string-list: note in docs that callers can specify sorting function
  2020-01-07 15:07 [PATCH 0/1] string-list: note in docs that callers can specify sorting function Elijah Newren via GitGitGadget
@ 2020-01-07 15:07 ` Elijah Newren via GitGitGadget
  0 siblings, 0 replies; 2+ messages in thread
From: Elijah Newren via GitGitGadget @ 2020-01-07 15:07 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Elijah Newren

From: Elijah Newren <newren@gmail.com>

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>
---
 string-list.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/string-list.h b/string-list.h
index 7bb0ad07e6..6c5d274126 100644
--- a/string-list.h
+++ b/string-list.h
@@ -4,7 +4,8 @@
 /**
  * The string_list API offers a data structure and functions to handle
  * sorted and unsorted arrays of strings.  A "sorted" list is one whose
- * entries are sorted by string value in `strcmp()` order.
+ * entries are sorted by string value in the order specified by the `cmp`
+ * member (`strcmp()` by default).
  *
  * The caller:
  *
@@ -209,7 +210,8 @@ 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);
 
 /**
- * Sort the list's entries by string value in `strcmp()` order.
+ * Sort the list's entries by string value in order specified by list->cmp
+ * (strcmp() if list->cmp is NULL).
  */
 void string_list_sort(struct string_list *list);
 
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-07 15:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07 15:07 [PATCH 0/1] string-list: note in docs that callers can specify sorting function Elijah Newren via GitGitGadget
2020-01-07 15:07 ` [PATCH 1/1] " Elijah Newren via GitGitGadget

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).