This commit is contained in:
Oleksandr Vyshniakov 2025-04-17 13:23:30 +02:00
parent 28d2e7604d
commit f808e6bb2e

View File

@ -16,21 +16,7 @@ list_t *new_list(size_t length, list_element_t elements[]) {
return list; return list;
} }
list_t *new_list(size_t length, list_element_t elements[]) {
list_t *result = malloc(sizeof(list_t) + sizeof(list_element_t) * length);
if (result == NULL) {
return NULL;
}
result->length = length;
if (elements != NULL) {
for (size_t idx = 0; idx < length; ++idx) {
result->elements[idx] = elements[idx];
}
}
return result;
}
void delete_list(list_t *lst) { void delete_list(list_t *lst) {
if (lst != NULL) { if (lst != NULL) {