diff options
author | Johannes Sixt <j.sixt@viscovery.net> | 2011-08-11 23:20:00 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-14 14:19:35 -0700 |
commit | 86d4b528d8a4752cc689279fb6d38c8697a507bb (patch) | |
tree | 960aa6832d1f56ba8f2ae53aa145b55eb430c0a2 /Documentation/technical | |
parent | aacb82de3ff8ae7b0a9e4cfec16c1807b6c315ef (diff) | |
download | git-86d4b528d8a4752cc689279fb6d38c8697a507bb.tar.gz git-86d4b528d8a4752cc689279fb6d38c8697a507bb.tar.xz |
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/technical')
-rw-r--r-- | Documentation/technical/api-string-list.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Documentation/technical/api-string-list.txt b/Documentation/technical/api-string-list.txt index 3f575bdcf..ce24eb96f 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 --------------- |