summaryrefslogtreecommitdiff
path: root/libarchive/archive_read_support_filter_rpm.c
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2020-03-14 21:44:48 +0000
committerEmil Velikov <emil.l.velikov@gmail.com>2021-10-23 19:26:23 +0100
commit4b7558e108c17de1417fb427ce0f771049e10ec5 (patch)
tree764c0440d3f9e57498967bde3734102e99ef8694 /libarchive/archive_read_support_filter_rpm.c
parent70ee6cb8268a8a52bab7a14e59a3949f05b7d0c3 (diff)
downloadlibarchive-4b7558e108c17de1417fb427ce0f771049e10ec5.tar.gz
reader: introduce struct archive_read_filter_vtable
As before - move the dispatch/function pointer so a const data segment. Separating it from the RW data section. Note: the close function is _not_ optional - remove the NULL check. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Diffstat (limited to 'libarchive/archive_read_support_filter_rpm.c')
-rw-r--r--libarchive/archive_read_support_filter_rpm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libarchive/archive_read_support_filter_rpm.c b/libarchive/archive_read_support_filter_rpm.c
index 2cce1745..67a979cd 100644
--- a/libarchive/archive_read_support_filter_rpm.c
+++ b/libarchive/archive_read_support_filter_rpm.c
@@ -127,6 +127,12 @@ rpm_bidder_bid(struct archive_read_filter_bidder *self,
return (bits_checked);
}
+static const struct archive_read_filter_vtable
+rpm_reader_vtable = {
+ .read = rpm_filter_read,
+ .close = rpm_filter_close,
+};
+
static int
rpm_bidder_init(struct archive_read_filter *self)
{
@@ -134,8 +140,6 @@ rpm_bidder_init(struct archive_read_filter *self)
self->code = ARCHIVE_FILTER_RPM;
self->name = "rpm";
- self->read = rpm_filter_read;
- self->close = rpm_filter_close;
rpm = (struct rpm *)calloc(sizeof(*rpm), 1);
if (rpm == NULL) {
@@ -146,6 +150,7 @@ rpm_bidder_init(struct archive_read_filter *self)
self->data = rpm;
rpm->state = ST_LEAD;
+ self->vtable = &rpm_reader_vtable;
return (ARCHIVE_OK);
}