file
cc_linkedlist.h
Classes
- struct cc_linkedlist_node
- struct cc_linkedlist
Typedefs
-
using cc_linkedlist_node_t = struct cc_
linkedlist_ node -
using cc_linkedlist_t = struct cc_
linkedlist
Functions
- auto compare(void* a, void* b, size_t size) -> int
-
auto cc_linkedlist_node_create(void* data,
size_t data_size) -> cc_
linkedlist_ node_ t* - create single node for linked list
-
void cc_linkedlist_init(cc_
linkedlist_ t* list, size_t data_size) - initialize an empty list
-
auto cc_linkedlist_size(cc_
linkedlist_ node_ t* head) -> size_t - gets the current size of linked list
-
void cc_linkedlist_insert_front(cc_
linkedlist_ t* list, void* data) - insert data beggining of the list
-
void cc_linkedlist_insert_back(cc_
linkedlist_ t* list, void* data) - insert data end of the list
-
void cc_linkedlist_node_delete(cc_
linkedlist_ t* list, void* data) - delete the first node with given data
-
auto cc_linkedlist_node_search(cc_
linkedlist_ t* list, void* data) -> cc_ linkedlist_ node_ t* - search node with given data
-
void cc_linkedlist_free(cc_
linkedlist_ t* list) - delete the entire list from heap
Defines
- #define CC_LINKEDLIST_LOG(format, ...)
Function documentation
cc_ linkedlist_ node_ t* cc_linkedlist_node_create(void* data,
size_t data_size)
create single node for linked list
Parameters | |
---|---|
data | to push to the linked list |
data_size | size of the data for allocating memory for it |
Returns | cc_linkedlist_node_t* |
void cc_linkedlist_init(cc_ linkedlist_ t* list,
size_t data_size)
initialize an empty list
Parameters | |
---|---|
list | list that head node points to NULL |
data_size | given by user |
size_t cc_linkedlist_size(cc_ linkedlist_ node_ t* head)
gets the current size of linked list
Parameters | |
---|---|
head | to point specified linked list |
Returns | size_t number of nodes |
void cc_linkedlist_insert_front(cc_ linkedlist_ t* list,
void* data)
insert data beggining of the list
Parameters | |
---|---|
list | list that data will be instered |
data | data that will be insert |
void cc_linkedlist_insert_back(cc_ linkedlist_ t* list,
void* data)
insert data end of the list
Parameters | |
---|---|
list | list that data will be instered |
data | data that will be insert |
void cc_linkedlist_node_delete(cc_ linkedlist_ t* list,
void* data)
delete the first node with given data
Parameters | |
---|---|
list | |
data |
cc_ linkedlist_ node_ t* cc_linkedlist_node_search(cc_ linkedlist_ t* list,
void* data)
search node with given data
Parameters | |
---|---|
list | |
data | |
Returns | cc_linkedlist_node_t* node that contains requested data |
void cc_linkedlist_free(cc_ linkedlist_ t* list)
delete the entire list from heap
Parameters | |
---|---|
list | to delete |