From: Emil Velikov Date: Sat, 14 Mar 2020 17:05:41 +0000 (+0000) Subject: reader: remove archive_read_filter_bidder_vtable::free stubs X-Git-Tag: v3.6.0~18^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8649d2a8e82f1b50c9eaf528df96046fee7420db;p=thirdparty%2Flibarchive.git reader: remove archive_read_filter_bidder_vtable::free stubs There is no point in having stubs around. The caller already checks if the function pointer is NULL before calling it. With this in place only one implementation remains in filter_program. Technically we can rework/remove that as well, although the solution might not be so clean, so let's keep that for another day. Signed-off-by: Emil Velikov --- diff --git a/libarchive/archive_read_support_filter_bzip2.c b/libarchive/archive_read_support_filter_bzip2.c index b04a6fdf6..3dd1f1def 100644 --- a/libarchive/archive_read_support_filter_bzip2.c +++ b/libarchive/archive_read_support_filter_bzip2.c @@ -70,7 +70,6 @@ static int bzip2_filter_close(struct archive_read_filter *); */ static int bzip2_reader_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); static int bzip2_reader_init(struct archive_read_filter *); -static int bzip2_reader_free(struct archive_read_filter_bidder *); #if ARCHIVE_VERSION_NUMBER < 4000000 /* Deprecated; remove in libarchive 4.0 */ @@ -97,7 +96,7 @@ archive_read_support_filter_bzip2(struct archive *_a) reader->name = "bzip2"; reader->bid = bzip2_reader_bid; reader->init = bzip2_reader_init; - reader->free = bzip2_reader_free; + reader->free = NULL; #if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR) return (ARCHIVE_OK); #else @@ -107,12 +106,6 @@ archive_read_support_filter_bzip2(struct archive *_a) #endif } -static int -bzip2_reader_free(struct archive_read_filter_bidder *self){ - (void)self; /* UNUSED */ - return (ARCHIVE_OK); -} - /* * Test whether we can handle this data. * diff --git a/libarchive/archive_read_support_filter_compress.c b/libarchive/archive_read_support_filter_compress.c index 94377ae82..166b145c7 100644 --- a/libarchive/archive_read_support_filter_compress.c +++ b/libarchive/archive_read_support_filter_compress.c @@ -133,7 +133,6 @@ struct private_data { static int compress_bidder_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); static int compress_bidder_init(struct archive_read_filter *); -static int compress_bidder_free(struct archive_read_filter_bidder *); static ssize_t compress_filter_read(struct archive_read_filter *, const void **); static int compress_filter_close(struct archive_read_filter *); @@ -166,7 +165,7 @@ archive_read_support_filter_compress(struct archive *_a) bidder->name = "compress (.Z)"; bidder->bid = compress_bidder_bid; bidder->init = compress_bidder_init; - bidder->free = compress_bidder_free; + bidder->free = NULL; return (ARCHIVE_OK); } @@ -304,16 +303,6 @@ compress_filter_read(struct archive_read_filter *self, const void **pblock) return (p - start); } -/* - * Clean up the reader. - */ -static int -compress_bidder_free(struct archive_read_filter_bidder *self) -{ - self->data = NULL; - return (ARCHIVE_OK); -} - /* * Close and release the filter. */ diff --git a/libarchive/archive_read_support_filter_grzip.c b/libarchive/archive_read_support_filter_grzip.c index 51f9239fc..782720ca5 100644 --- a/libarchive/archive_read_support_filter_grzip.c +++ b/libarchive/archive_read_support_filter_grzip.c @@ -54,13 +54,6 @@ static int grzip_bidder_bid(struct archive_read_filter_bidder *, static int grzip_bidder_init(struct archive_read_filter *); -static int -grzip_reader_free(struct archive_read_filter_bidder *self) -{ - (void)self; /* UNUSED */ - return (ARCHIVE_OK); -} - int archive_read_support_filter_grzip(struct archive *_a) { @@ -76,7 +69,7 @@ archive_read_support_filter_grzip(struct archive *_a) reader->data = NULL; reader->bid = grzip_bidder_bid; reader->init = grzip_bidder_init; - reader->free = grzip_reader_free; + reader->free = NULL; /* This filter always uses an external program. */ archive_set_error(_a, ARCHIVE_ERRNO_MISC, "Using external grzip program for grzip decompression"); diff --git a/libarchive/archive_read_support_filter_lrzip.c b/libarchive/archive_read_support_filter_lrzip.c index 01cbf3813..81bbec253 100644 --- a/libarchive/archive_read_support_filter_lrzip.c +++ b/libarchive/archive_read_support_filter_lrzip.c @@ -53,13 +53,6 @@ static int lrzip_bidder_bid(struct archive_read_filter_bidder *, static int lrzip_bidder_init(struct archive_read_filter *); -static int -lrzip_reader_free(struct archive_read_filter_bidder *self) -{ - (void)self; /* UNUSED */ - return (ARCHIVE_OK); -} - int archive_read_support_filter_lrzip(struct archive *_a) { @@ -76,7 +69,7 @@ archive_read_support_filter_lrzip(struct archive *_a) reader->name = "lrzip"; reader->bid = lrzip_bidder_bid; reader->init = lrzip_bidder_init; - reader->free = lrzip_reader_free; + reader->free = NULL; /* This filter always uses an external program. */ archive_set_error(_a, ARCHIVE_ERRNO_MISC, "Using external lrzip program for lrzip decompression"); diff --git a/libarchive/archive_read_support_filter_lz4.c b/libarchive/archive_read_support_filter_lz4.c index a9c4de1df..cfa6870ee 100644 --- a/libarchive/archive_read_support_filter_lz4.c +++ b/libarchive/archive_read_support_filter_lz4.c @@ -99,7 +99,6 @@ static int lz4_filter_close(struct archive_read_filter *); */ static int lz4_reader_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); static int lz4_reader_init(struct archive_read_filter *); -static int lz4_reader_free(struct archive_read_filter_bidder *); #if defined(HAVE_LIBLZ4) static ssize_t lz4_filter_read_default_stream(struct archive_read_filter *, const void **); @@ -123,7 +122,7 @@ archive_read_support_filter_lz4(struct archive *_a) reader->name = "lz4"; reader->bid = lz4_reader_bid; reader->init = lz4_reader_init; - reader->free = lz4_reader_free; + reader->free = NULL; #if defined(HAVE_LIBLZ4) return (ARCHIVE_OK); #else @@ -133,12 +132,6 @@ archive_read_support_filter_lz4(struct archive *_a) #endif } -static int -lz4_reader_free(struct archive_read_filter_bidder *self){ - (void)self; /* UNUSED */ - return (ARCHIVE_OK); -} - /* * Test whether we can handle this data. *