Mercurial > hg > th-libs
changeset 730:1a3ea8f7bb35
Use specified deallocator for ringbuffers when rotating.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 07 Dec 2022 00:06:45 +0200 |
parents | ef1521b179b1 |
children | 98d12f33da7b |
files | th_datastruct.c |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/th_datastruct.c Fri Feb 25 15:25:16 2022 +0200 +++ b/th_datastruct.c Wed Dec 07 00:06:45 2022 +0200 @@ -344,8 +344,7 @@ { for (size_t i = 0; i < buf->size; i++) { - if (buf->data[i] != NULL) - buf->deallocator(buf->data[i]); + buf->deallocator(buf->data[i]); } th_free(buf->data); @@ -360,7 +359,7 @@ if (buf->n < buf->size) buf->n++; - th_free(buf->data[0]); + buf->deallocator(buf->data[0]); memmove(&(buf->data[0]), &(buf->data[1]), (buf->size - 1) * sizeof(void *)); buf->data[buf->size - 1] = ptr; }