From 9f55a17009446a7586a3694edb0b54988e201e7f Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 23 Oct 2021 18:19:08 +0000 Subject: item queue: implemented tpax_append_prefix_item(). --- src/driver/tpax_driver_ctx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/driver') diff --git a/src/driver/tpax_driver_ctx.c b/src/driver/tpax_driver_ctx.c index 0a92537..c621bb6 100644 --- a/src/driver/tpax_driver_ctx.c +++ b/src/driver/tpax_driver_ctx.c @@ -276,6 +276,12 @@ static struct tpax_driver_ctx_impl * tpax_driver_ctx_alloc( ictx->ctx.errinfp = &ictx->ctx.erriptr[0]; ictx->ctx.erricap = &ictx->ctx.erriptr[--elements]; + elements = sizeof(ictx->ctx.prefptr) / sizeof(*ictx->ctx.prefptr); + + ictx->ctx.prefixv = &ictx->ctx.prefptr[0]; + ictx->ctx.prefixp = &ictx->ctx.prefptr[0]; + ictx->ctx.prefcap = &ictx->ctx.prefptr[--elements]; + ictx->meta = meta; for (entry=meta->entries,units=ictx->units; entry->fopt || entry->arg; entry++) @@ -561,6 +567,7 @@ static void tpax_free_driver_ctx_impl(struct tpax_driver_ctx_alloc * ictx) { void * next; size_t size; + char ** ppref; for (; ictx->ctx.dirents; ) { next = ictx->ctx.dirents->next; @@ -576,6 +583,12 @@ static void tpax_free_driver_ctx_impl(struct tpax_driver_ctx_alloc * ictx) if (ictx->ctx.dirbuff) munmap(ictx->ctx.dirbuff,TPAX_DIRENT_BUFLEN); + for (ppref=ictx->ctx.prefixv; *ppref; ppref++) + free(*ppref); + + if (ictx->ctx.prefixv != ictx->ctx.prefptr) + free(ictx->ctx.prefixv); + argv_free(ictx->meta); free(ictx); } -- cgit v1.2.3