]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
reader: remove archive_read_filter_bidder_vtable::free stubs
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 14 Mar 2020 17:05:41 +0000 (17:05 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Sat, 23 Oct 2021 18:26:23 +0000 (19:26 +0100)
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>
libarchive/archive_read_support_filter_bzip2.c
libarchive/archive_read_support_filter_compress.c
libarchive/archive_read_support_filter_grzip.c
libarchive/archive_read_support_filter_lrzip.c
libarchive/archive_read_support_filter_lz4.c

index b04a6fdf6216e1f77f2d5d9a76c9515de6058e51..3dd1f1defce0835fbdef8273c9cec8815c5fdac7 100644 (file)
@@ -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.
  *
index 94377ae821feba7b7a505207d186ed450f33af68..166b145c7c03f28b637dfce10a354816e1eca734 100644 (file)
@@ -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.
  */
index 51f9239fcbdbc94e79a78f695b2bbc6042cac486..782720ca5e2040b0b8382286b0f134345632067d 100644 (file)
@@ -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");
index 01cbf38138461300595188e70b6b12cca5fbfe9b..81bbec253ca78e4dede4fca8ded11b9356b28a43 100644 (file)
@@ -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");
index a9c4de1df432591b73853a6766999a21a2b4d38b..cfa6870eec709327979a2edb1008281694aba59e 100644 (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.
  *