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