From 7bd90b8048fd6937766dff7474947dd80205ea7e Mon Sep 17 00:00:00 2001 From: John Keeping Date: Sun, 12 Jan 2014 17:13:52 +0000 Subject: filter: add interface layer Change the existing cgit_{open,close,fprintf}_filter functions to delegate to filter-specific implementations accessed via function pointers on the cgit_filter object. We treat the "exec" filter type slightly specially here by putting its structure definition in the header file and providing an "init" function to set up the function pointers. This is required so that the ui-snapshot.c code that applies a compression filter can continue to use the filter interface to do so. Signed-off-by: John Keeping --- ui-snapshot.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'ui-snapshot.c') diff --git a/ui-snapshot.c b/ui-snapshot.c index 5136c49..7115ec4 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c @@ -58,13 +58,12 @@ static int write_compressed_tar_archive(const char *hex, char *filter_argv[]) { int rv; - struct cgit_filter f = { - .cmd = filter_argv[0], - .argv = filter_argv, - }; - cgit_open_filter(&f); + struct cgit_exec_filter f; + cgit_exec_filter_init(&f, filter_argv[0], filter_argv); + + cgit_open_filter(&f.base); rv = write_tar_archive(hex, prefix); - cgit_close_filter(&f); + cgit_close_filter(&f.base); return rv; } -- cgit v1.2.3-70-g09d2