correction
Tests TP prog-104-p-02-2030 / test (push) Failing after 32s

This commit is contained in:
2026-04-03 17:05:17 +02:00
parent 7ae0683809
commit 3c46959903
@@ -32,6 +32,7 @@ int dlist_insert(struct dlist **l, size_t index, int e)
new_node->prev = NULL; new_node->prev = NULL;
new_node->next = *l; new_node->next = *l;
new_node->data = e; new_node->data = e;
new_node->next->prev = new_node;
//dlist_append(*l, e); //dlist_append(*l, e);
return 0; return 0;
@@ -58,19 +59,18 @@ int dlist_insert(struct dlist **l, size_t index, int e)
return 0; return 0;
} }
struct dlist *dlist_delete_at(struct dlist **l, size_t index) struct dlist *dlist_delete_at(struct dlist **l, size_t index)
{ {
if(!l || *l) return NULL; if(!l || *l) return NULL;
struct dlist *old = *l; struct dlist *old = *l;
if(index == 0){ if(index == 0){
old->next->prev = NULL; old->next->prev = NULL;
*l = old->next; *l = old->next;
return old; return old;
} }
@@ -87,8 +87,10 @@ struct dlist *dlist_delete_at(struct dlist **l, size_t index)
old = tmp->next; old = tmp->next;
tmp->prev = old->prev; tmp->prev = old->prev;
tmp->next = old->next; tmp->next = old->next;
return old; return old;
} }
return NULL; return NULL;
} }