diff options
author | justanothercatgirl <sotov2070@gmail.com> | 2024-08-31 16:25:24 +0300 |
---|---|---|
committer | justanothercatgirl <sotov2070@gmail.com> | 2024-08-31 17:26:00 +0300 |
commit | 2d5e1fa41c65c70ad18c5912a79190d08e6d9e98 (patch) | |
tree | b99d126ef6e088ed013cb878b845ab88a3d72800 /include/container.h | |
parent | 7ce795494d10d64f527f5a6076789d20f2f87091 (diff) |
Fixed ll_remove_elem bug
Diffstat (limited to 'include/container.h')
-rw-r--r-- | include/container.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/container.h b/include/container.h index db4fa4f..c84b894 100644 --- a/include/container.h +++ b/include/container.h @@ -897,9 +897,13 @@ void ll_remove_elem(struct linked_list* list, const void* elem, qsort_cmp_t cmp) *snd = fst->next; while (snd != NULL) { if (cmp(snd->data, elem) == 0) { + if (snd->next == NULL) list->last = fst; fst->next = ll_free_node(list, snd); + --list->meta.assumed_size; return; } + fst = snd; + snd = snd->next; } if (cmp(fst->data, elem) == 0) ll_remove_back(list); } |