summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJohannes Sixt <j.sixt@viscovery.net>2011-08-11 23:20:00 -0600
committerJunio C Hamano <gitster@pobox.com>2011-08-14 14:19:35 -0700
commit86d4b528d8a4752cc689279fb6d38c8697a507bb (patch)
tree960aa6832d1f56ba8f2ae53aa145b55eb430c0a2 /Documentation
parentaacb82de3ff8ae7b0a9e4cfec16c1807b6c315ef (diff)
downloadgit-86d4b528d8a4752cc689279fb6d38c8697a507bb.tar.gz
string-list: Add API to remove an item from an unsorted list
Teach the string-list API how to remove an entry in O(1) runtime by moving the last entry to the vacated spot. As such, the routine works only for unsorted lists. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/technical/api-string-list.txt10
1 files changed, 10 insertions, 0 deletions
diff --git a/Documentation/technical/api-string-list.txt b/Documentation/technical/api-string-list.txt
index 3f575bdcff..ce24eb96f5 100644
--- a/Documentation/technical/api-string-list.txt
+++ b/Documentation/technical/api-string-list.txt
@@ -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:
@@ -112,6 +115,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
---------------