@@ -87,6 +87,7 @@ struct list *list_get(struct list *l, size_t index){
|
||||
tmp = tmp->next;
|
||||
ind ++;
|
||||
}
|
||||
|
||||
if(ind >= index) return NULL;
|
||||
|
||||
return tmp;
|
||||
@@ -96,7 +97,9 @@ struct list *list_get(struct list *l, size_t index){
|
||||
void list_destroy(struct list *l){
|
||||
|
||||
if (!l) return;
|
||||
|
||||
list_destroy(l->next);
|
||||
|
||||
free(l);
|
||||
}
|
||||
|
||||
@@ -151,7 +154,7 @@ int list_remove(struct list **l, int e){
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
if (!tmp) return NULL;
|
||||
if (!tmp) return 0;
|
||||
|
||||
if(!old) *l = tmp->next;
|
||||
else old->next = tmp->next;
|
||||
|
||||
Reference in New Issue
Block a user