From 811aa36ab6ee4da8daca386f8c3c338a720a4f0d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 31 Oct 2024 16:00:13 +0100 Subject: [PATCH] iovw: add simpler iovw_done() destructor --- src/basic/iovec-wrapper.h | 4 ++++ src/shared/journal-importer.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/basic/iovec-wrapper.h b/src/basic/iovec-wrapper.h index 0c6d760a73e..4754b98fbb8 100644 --- a/src/basic/iovec-wrapper.h +++ b/src/basic/iovec-wrapper.h @@ -23,6 +23,10 @@ static inline void iovw_done_free(struct iovec_wrapper *iovw) { iovw_free_contents(iovw, true); } +static inline void iovw_done(struct iovec_wrapper *iovw) { + iovw_free_contents(iovw, false); +} + int iovw_put(struct iovec_wrapper *iovw, void *data, size_t len); static inline int iovw_consume(struct iovec_wrapper *iovw, void *data, size_t len) { /* Move data into iovw or free on error */ diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c index 4dc0b8f662a..9264638303f 100644 --- a/src/shared/journal-importer.c +++ b/src/shared/journal-importer.c @@ -33,7 +33,7 @@ void journal_importer_cleanup(JournalImporter *imp) { free(imp->name); free(imp->buf); - iovw_free_contents(&imp->iovw, false); + iovw_done(&imp->iovw); } static char* realloc_buffer(JournalImporter *imp, size_t size) { @@ -452,7 +452,7 @@ void journal_importer_drop_iovw(JournalImporter *imp) { /* This function drops processed data that along with the iovw that points at it */ - iovw_free_contents(&imp->iovw, false); + iovw_done(&imp->iovw); /* possibly reset buffer position */ remain = imp->filled - imp->offset;