linked-list: Remove unused replace() method

Its functionality can be replicated by calling insert_before() followed
by remove_at().  Not the other way around, though, because remove_at()
changes the enumerator position.
This commit is contained in:
Tobias Brunner
2013-07-17 17:42:53 +02:00
parent 20ea35679e
commit be3c09d020
3 changed files with 54 additions and 68 deletions
@@ -316,20 +316,6 @@ METHOD(linked_list_t, insert_before, void,
this->count++;
}
METHOD(linked_list_t, replace, void*,
private_linked_list_t *this, private_enumerator_t *enumerator,
void *item)
{
void *old = NULL;
if (enumerator->current)
{
old = enumerator->current->value;
enumerator->current->value = item;
}
return old;
}
METHOD(linked_list_t, get_last, status_t,
private_linked_list_t *this, void **item)
{
@@ -556,7 +542,6 @@ linked_list_t *linked_list_create()
.insert_first = _insert_first,
.insert_last = _insert_last,
.insert_before = (void*)_insert_before,
.replace = (void*)_replace,
.remove_first = _remove_first,
.remove_last = _remove_last,
.remove = _remove_,
@@ -117,16 +117,6 @@ struct linked_list_t {
void (*insert_before)(linked_list_t *this, enumerator_t *enumerator,
void *item);
/**
* Replaces the item the enumerator currently points to with the given item.
*
* @param enumerator enumerator with position
* @param item item value to replace current item with
* @return current item or NULL if the enumerator is at an
* invalid position
*/
void *(*replace)(linked_list_t *this, enumerator_t *enumerator, void *item);
/**
* Remove an item from the list where the enumerator points to.
*