63 CHECK_DO(ref_llist_head!= NULL,
return STAT_EINVAL);
64 CHECK_DO(data!= NULL,
return STAT_EINVAL);
67 CHECK_DO(new_node!= NULL,
return STAT_ENOMEM);
70 new_node->next= *ref_llist_head;
71 *ref_llist_head= new_node;
82 CHECK_DO(ref_llist_head!= NULL,
return NULL);
85 if((head= *ref_llist_head)== NULL)
89 *ref_llist_head= head->next;
105 curr_node= (
llist_t*)llist_head;
106 while(curr_node!= NULL) {
108 curr_node= curr_node->next;
122 if(llist_head== NULL)
126 curr_node= (
llist_t*)llist_head;
129 while(curr_node!= NULL) {
131 return curr_node->data;
132 curr_node= curr_node->next;
144 CHECK_DO(ref_llist_head!= NULL,
return STAT_ERROR);
145 CHECK_DO(index>= 0,
return STAT_ERROR);
146 CHECK_DO(data!= NULL,
return STAT_ERROR);
152 curr_node= ref_llist_head;
153 for(i= 0; i< index- 1; i++) {
154 if(*curr_node== NULL)
156 curr_node= &(*curr_node)->next;
158 if(*curr_node== NULL)
void * llist_get_nth(const llist_t *llist_head, int index)
int llist_insert_nth(llist_t **ref_llist_head, int index, void *data)
General status codes enumeration.
#define CHECK_DO(COND, ACTION)
int llist_push(llist_t **ref_llist_head, void *data)
Simple linked-list utility implementation.
int llist_len(const llist_t *llist_head)
void * llist_pop(llist_t **ref_llist_head)