Code

string-list: document that string_list_insert() inserts unique strings
[git.git] / Documentation / technical / api-string-list.txt
index 3f575bdcff3a6b38304710b22371784c2e7443c9..5a0c14fcebfcf4d5cbad4900d062703412c501e1 100644 (file)
@@ -29,6 +29,9 @@ member (you need this if you add things later) and you should set the
 
 . Can sort an unsorted list using `sort_string_list`.
 
+. Can remove individual items of an unsorted list using
+  `unsorted_string_list_delete_item`.
+
 . Finally it should free the list using `string_list_clear`.
 
 Example:
@@ -80,7 +83,9 @@ Functions
 
        Insert a new element to the string_list. The returned pointer can be
        handy if you want to write something to the `util` pointer of the
-       string_list_item containing the just added string.
+       string_list_item containing the just added string. If the given
+       string already exists the insertion will be skipped and the
+       pointer to the existing item returned.
 +
 Since this function uses xrealloc() (which die()s if it fails) if the
 list needs to grow, it is safe not to check the pointer. I.e. you may
@@ -112,6 +117,13 @@ write `string_list_insert(...)->util = ...;`.
 The above two functions need to look through all items, as opposed to their
 counterpart for sorted lists, which performs a binary search.
 
+`unsorted_string_list_delete_item`::
+
+       Remove an item from a string_list. The `string` pointer of the items
+       will be freed in case the `strdup_strings` member of the string_list
+       is set. The third parameter controls if the `util` pointer of the
+       items should be freed or not.
+
 Data structures
 ---------------