]> git.ipfire.org Git - thirdparty/libarchive.git/commit
reader: transform get_bidder into register_bidder
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 23 Oct 2021 17:22:05 +0000 (18:22 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Sat, 23 Oct 2021 18:26:23 +0000 (19:26 +0100)
commit5b5f6b591bced6037959945f69ab46466abd1698
tree0ca11fbd330c1fd1aa1a19daea93a50948fb2992
parent64b82ac5c8cb5d822962af988dd075331d997b79
reader: transform get_bidder into register_bidder

There's a notable duplication across all the read bidder code.

Check the archive magic/state, set the bidder private data (to NULL in
all but one case), name and vtable.

Change the helper to do the actual registration, keeping things simpler
in the dozen+ filters. This also allows us to enforce the bidder ::bid
and ::init dispatch are non NULL. The final one ::free is optional.

NOTE: some of the bidders do _not_ set a name, which I suspect is a
pre-existing bug. I've left them as-is, but we might want to fix and
enforce that somehow.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
14 files changed:
libarchive/archive_read.c
libarchive/archive_read_private.h
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_gzip.c
libarchive/archive_read_support_filter_lrzip.c
libarchive/archive_read_support_filter_lz4.c
libarchive/archive_read_support_filter_lzop.c
libarchive/archive_read_support_filter_program.c
libarchive/archive_read_support_filter_rpm.c
libarchive/archive_read_support_filter_uu.c
libarchive/archive_read_support_filter_xz.c
libarchive/archive_read_support_filter_zstd.c