diff --git a/src/imamll.c b/src/imamll.c index 5e5b3d8..09c4e04 100644 --- a/src/imamll.c +++ b/src/imamll.c @@ -424,10 +424,14 @@ int imamLL_element_remove (struct imamLL *list, struct imamLL_element *element, } } -struct imamLL_element *imamLL_element_get (struct imamLL *list, const void *element_data, size_t data_size) +struct imamLL_element *imamLL_element_get (struct imamLL *list, const void *element_data, size_t data_size, uint8_t follow_cursor) { int found = 0; - struct imamLL_element *tmp = list->first; + struct imamLL_element *tmp = NULL; + + if (follow_cursor == 0) tmp = list->first; + else tmp = list->current; + if (tmp == NULL) { list->error = EMPTY_LIST; return NULL; diff --git a/src/imamll.h b/src/imamll.h index c0fac46..da05a3c 100644 --- a/src/imamll.h +++ b/src/imamll.h @@ -107,7 +107,7 @@ extern void imamLL_element_remove_number (struct imamLL *list, int8_t direction, /* returns the pointer of a matching element */ /* Return Value: upon successful returns pointer to first found element in a list, otherwise returns NULL and sets appropriate error no to error variable of a list*/ -extern struct imamLL_element *imamLL_element_get (struct imamLL *list, const void *element_data, size_t data_size); +extern struct imamLL_element *imamLL_element_get (struct imamLL *list, const void *element_data, size_t data_size, uint8_t follow_cursor); /* returns the pointer of the next element in the list */ /* Return Value: upon successful returns pointer to the next element in a list, otherwise returns NULL*/