Thread (5 messages) flat view 5 messages, 3 authors, 2017-09-21

Re: [PATCH 2/2] Document the string_list structure

From: Jeff King <hidden>
Date: 2017-09-21 16:24:24

On Thu, Sep 21, 2017 at 02:43:38PM +0200, Han-Wen Nienhuys wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Han-Wen Nienhuys <redacted>
---
 string-list.h | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/string-list.h b/string-list.h
index 29bfb7ae4..08b534166 100644
--- a/string-list.h
+++ b/string-list.h
@@ -8,6 +8,12 @@ struct string_list_item {
 
 typedef int (*compare_strings_fn)(const char *, const char *);
 
+/* A resizable array of strings. The strings are owned if
+ * 'strdup_strings' is set. It can be used as a sorted array, and a
+ * custom comparison may be given in 'cmp'. The field 'items[i].util'
+ * may be used to implement an array of pairs. In that case, the
+ * caller is responsible for managing memory pointed to by 'util'.
+ */
 struct string_list {
 	struct string_list_item *items;
 	unsigned int nr, alloc;
There's a considerable amount of documentation for string-list in
Documentation/technical/api-string-list.txt.

Perhaps we should look at migrating it into string-list.h, where it's
more likely to be found (and kept up to date). We did something similar
for strbuf.h a while back, and I think the result is much better. See
the commits in:

  git log bdfdaa4978^..d468fa2721

for an example.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help