Improve list tests

This commit is contained in:
2023-01-02 22:01:51 +01:00
parent c7488b0f59
commit 26869c0df5
2 changed files with 11 additions and 2 deletions

View File

@ -54,7 +54,7 @@ void *list_insert(void *list_ptr, void *elem, int n) {
}
}
unsigned char *array = list_ptr;
unsigned char *array = (unsigned char *) list + sizeof(list_meta_t);
if (n < list->size)
memmove(array + (n + 1) * list->elem_size, array + n * list->elem_size, (list->size - n) * list->elem_size);