diff options
author | Emil Velikov <emil.l.velikov@gmail.com> | 2020-03-14 21:44:48 +0000 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2021-10-23 19:26:23 +0100 |
commit | 4b7558e108c17de1417fb427ce0f771049e10ec5 (patch) | |
tree | 764c0440d3f9e57498967bde3734102e99ef8694 /libarchive/archive_read_support_filter_program.c | |
parent | 70ee6cb8268a8a52bab7a14e59a3949f05b7d0c3 (diff) | |
download | libarchive-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_program.c')
-rw-r--r-- | libarchive/archive_read_support_filter_program.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libarchive/archive_read_support_filter_program.c b/libarchive/archive_read_support_filter_program.c index 83935474..885b2c20 100644 --- a/libarchive/archive_read_support_filter_program.c +++ b/libarchive/archive_read_support_filter_program.c @@ -382,6 +382,12 @@ child_read(struct archive_read_filter *self, char *buf, size_t buf_len) } } +static const struct archive_read_filter_vtable +program_reader_vtable = { + .read = program_filter_read, + .close = program_filter_close, +}; + int __archive_read_program(struct archive_read_filter *self, const char *cmd) { @@ -428,8 +434,7 @@ __archive_read_program(struct archive_read_filter *self, const char *cmd) } self->data = state; - self->read = program_filter_read; - self->close = program_filter_close; + self->vtable = &program_reader_vtable; /* XXX Check that we can read at least one byte? */ return (ARCHIVE_OK); |