fix: list no longer sets length to capacity

main
Sara 2024-02-28 11:31:19 +01:00
parent 7b20909c54
commit ff87fa96e1
1 changed files with 1 additions and 1 deletions

2
list.c
View File

@ -29,7 +29,7 @@ List list_with_len(size_t element_size, size_t len) {
List list_copy(const List* source) { List list_copy(const List* source) {
List self = list_init(source->element_size); List self = list_init(source->element_size);
list_set_len(&self, source->cap); list_set_len(&self, source->len);
if(self.cap > 0) { if(self.cap > 0) {
memcpy(self.data, source->data, source->element_size * source->len); memcpy(self.data, source->data, source->element_size * source->len);
} else { } else {