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 <emil.l.velikov@gmail.com>
This commit is contained in:
Emil Velikov committed 2021-10-23 19:26:23 +01:00
1 parent b30dd6c276
commit 8649d2a8e8
5 files changed
+5 -44

No files matched your search

@@ -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.
*
@@ -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.
*/
@@ -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");
@@ -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");
+1 -8
View File
@@ -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.
*