fix: list no longer sets length to capacity
parent
7b20909c54
commit
ff87fa96e1
2
list.c
2
list.c
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue