From d250c2651652e8bd51bb4bfa9cf83b725caaaafa Mon Sep 17 00:00:00 2001 From: Imam Date: Sun, 17 Sep 2023 09:36:57 +1000 Subject: [PATCH] Add files via upload --- src/imamll.c | 8 ++++++-- src/imamll.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) 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*/