summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2020-03-14 17:05:41 +0000
committerEmil Velikov <emil.l.velikov@gmail.com>2021-10-23 19:26:23 +0100
commit8649d2a8e82f1b50c9eaf528df96046fee7420db (patch)
tree7d056c2743f7d291ac6262865cac4974dffa580e
parentb30dd6c2762b6c0cc9aeb676076f7619c49a381b (diff)
downloadlibarchive-8649d2a8e82f1b50c9eaf528df96046fee7420db.tar.gz
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>
-rw-r--r--libarchive/archive_read_support_filter_bzip2.c9
-rw-r--r--libarchive/archive_read_support_filter_compress.c13
-rw-r--r--libarchive/archive_read_support_filter_grzip.c9
-rw-r--r--libarchive/archive_read_support_filter_lrzip.c9
-rw-r--r--libarchive/archive_read_support_filter_lz4.c9
5 files changed, 5 insertions, 44 deletions
diff --git a/libarchive/archive_read_support_filter_bzip2.c b/libarchive/archive_read_support_filter_bzip2.c
index b04a6fdf..3dd1f1de 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 94377ae8..166b145c 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);
}
@@ -305,16 +304,6 @@ compress_filter_read(struct archive_read_filter *self, const void **pblock)
}
/*
- * 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.
*/
static int
diff --git a/libarchive/archive_read_support_filter_grzip.c b/libarchive/archive_read_support_filter_grzip.c
index 51f9239f..782720ca 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 01cbf381..81bbec25 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 a9c4de1d..cfa6870e 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.
*