refresh
This commit is contained in:
parent
28d2e7604d
commit
f808e6bb2e
@ -16,21 +16,7 @@ list_t *new_list(size_t length, list_element_t elements[]) {
|
||||
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) {
|
||||
if (lst != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user