mirror of
https://github.com/hmaxnl/netex.git
synced 2025-01-18 15:34:20 +01:00
[ADD] Extended list functionality (added node search)
This commit is contained in:
parent
4c9c547e62
commit
c3a2f00edc
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
list_node * insert_end(list_node* list, void* data)
|
list_node * insert_node(list_node* list, void* data)
|
||||||
{
|
{
|
||||||
list_node* node = (list_node*)malloc(sizeof(list_node));
|
list_node* node = (list_node*)malloc(sizeof(list_node));
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
|
@ -60,4 +60,21 @@ void iterate_list(list_node* list, bool forward, int (*iterFunc)(const void*))
|
||||||
else
|
else
|
||||||
current = current->previous;
|
current = current->previous;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list_node* find_node(list_node* list_start, bool forward, int (*findFunc)(const void*))
|
||||||
|
{
|
||||||
|
if (list_start == NULL || findFunc == NULL)
|
||||||
|
return NULL;
|
||||||
|
list_node* current = list_start;
|
||||||
|
while (current != NULL)
|
||||||
|
{
|
||||||
|
if (findFunc(current->data) == 1)
|
||||||
|
return current;
|
||||||
|
if (forward)
|
||||||
|
current = current->next;
|
||||||
|
else
|
||||||
|
current = current->previous;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
|
@ -20,6 +20,7 @@ int shutdown_logger(const void* data)
|
||||||
free(logger);
|
free(logger);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void shutdown_log(app_logger_info* appLogger)
|
void shutdown_log(app_logger_info* appLogger)
|
||||||
{
|
{
|
||||||
canLog = false;
|
canLog = false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user