From 203497d80e66fdfb4e7fc10daf2597907a15a9ce Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Thu, 19 May 2011 19:26:06 +0200 Subject: Removed unneeded and confusing insert_after method from linked_list_t. --- src/libstrongswan/utils/linked_list.c | 8 -------- src/libstrongswan/utils/linked_list.h | 23 ++++++----------------- 2 files changed, 6 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/libstrongswan/utils/linked_list.c b/src/libstrongswan/utils/linked_list.c index 67cb821e0..9cf735f0e 100644 --- a/src/libstrongswan/utils/linked_list.c +++ b/src/libstrongswan/utils/linked_list.c @@ -475,13 +475,6 @@ METHOD(linked_list_t, insert_before, void, insert_item_before(this, enumerator->current, item); } -METHOD(linked_list_t, insert_after, void, - private_linked_list_t *this, private_enumerator_t *enumerator, - void *item) -{ - insert_item_after(this, enumerator->current, item); -} - METHOD(linked_list_t, replace, void*, private_linked_list_t *this, private_enumerator_t *enumerator, void *item) @@ -740,7 +733,6 @@ linked_list_t *linked_list_create() .find_last = (void*)_find_last, .insert_first = _insert_first, .insert_last = _insert_last, - .insert_after = (void*)_insert_after, .insert_before = (void*)_insert_before, .replace = (void*)_replace, .remove_first = _remove_first, diff --git a/src/libstrongswan/utils/linked_list.h b/src/libstrongswan/utils/linked_list.h index 9d4267ea5..fa92d539d 100644 --- a/src/libstrongswan/utils/linked_list.h +++ b/src/libstrongswan/utils/linked_list.h @@ -77,8 +77,8 @@ struct linked_list_t { /** * Create an enumerator over the list. * - * The enumerator is a "lightweight" iterator. It only has two methods - * and should therefore be much easier to implement. + * @note The enumerator's position is invalid before the first call + * to enumerate(). * * @return enumerator over list items */ @@ -109,8 +109,11 @@ struct linked_list_t { /** * Inserts a new item before the item the enumerator currently points to. * + * If the enumerator's position is invalid, e.g. at the end of the list, + * the item is inserted last. This is helpful when inserting items into a + * sorted list. + * * @note The position of the enumerator is not changed. - * @note If the enumerator's position is invalid, the item is inserted last. * * @param enumerator enumerator with position * @param item item value to insert in list @@ -118,20 +121,6 @@ struct linked_list_t { void (*insert_before)(linked_list_t *this, enumerator_t *enumerator, void *item); - /** - * Inserts a new item after the item the enumerator currently points to. - * - * @note The position of the enumerator is not changed (thus the next item - * the enumerator returns will be the inserted item). - * - * @note If the enumerator's position is invalid, the item is inserted last. - * - * @param enumerator enumerator with position - * @param item item value to insert in list - */ - void (*insert_after)(linked_list_t *this, enumerator_t *enumerator, - void *item); - /** * Replaces the item the enumerator currently points to with the given item. * -- cgit v1.2.3