- changed iterator->remove behavior
This commit is contained in:
@@ -50,6 +50,7 @@ struct iterator_t {
|
|||||||
* @return number of list items
|
* @return number of list items
|
||||||
*/
|
*/
|
||||||
int (*get_count) (iterator_t *this);
|
int (*get_count) (iterator_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Iterate over all items.
|
* @brief Iterate over all items.
|
||||||
*
|
*
|
||||||
@@ -125,10 +126,9 @@ struct iterator_t {
|
|||||||
/**
|
/**
|
||||||
* @brief Removes an element from list at the given iterator position.
|
* @brief Removes an element from list at the given iterator position.
|
||||||
*
|
*
|
||||||
* The position of the iterator is set in the following order:
|
* The iterator is set the the following position:
|
||||||
* - to the item before, if available
|
* - to the item before, if available
|
||||||
* - otherwise to the item after, if available
|
* - it gets reseted, otherwise
|
||||||
* - otherwise it gets reseted
|
|
||||||
*
|
*
|
||||||
* @param linked_list calling object
|
* @param linked_list calling object
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -268,10 +268,6 @@ static status_t remove(private_iterator_t *this)
|
|||||||
{
|
{
|
||||||
new_current = this->current->previous;
|
new_current = this->current->previous;
|
||||||
}
|
}
|
||||||
else if (this->current->next != NULL)
|
|
||||||
{
|
|
||||||
new_current = this->current->next;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new_current = NULL;
|
new_current = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user