Mercurial > libedl
diff src/edl.c @ 6:7137fbac0b85
edl: expose EDL_reallocate() API to allow resizing the array
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Thu, 28 Dec 2023 16:47:24 -0500 |
parents | c2408abb258a |
children | 0c98b46eaf73 |
line wrap: on
line diff
--- a/src/edl.c Mon Dec 25 16:26:46 2023 -0500 +++ b/src/edl.c Thu Dec 28 16:47:24 2023 -0500 @@ -144,7 +144,7 @@ /* memory management routines */ -static int EDL_internal_reallocate(EDL* input, size_t new_capacity) { +int EDL_reallocate(EDL* input, size_t new_capacity) { input->arr = realloc(input->arr, new_capacity * sizeof(EDL_line)); if (!input->arr) return 0; @@ -160,7 +160,7 @@ /* the important function */ EDL EDL_parse(const char* data, size_t length) { EDL edl = {0}; - if (!EDL_internal_reallocate(&edl, 16)) + if (!EDL_reallocate(&edl, 16)) return edl; size_t order_size = 0; @@ -282,10 +282,10 @@ break; if (++edl.size >= edl.capacity) - EDL_internal_reallocate(&edl, edl.capacity * 2); + EDL_reallocate(&edl, edl.capacity * 2); } - EDL_internal_reallocate(&edl, edl.size); + EDL_reallocate(&edl, edl.size); free(order);