aboutsummaryrefslogtreecommitdiff
path: root/filter.c
Commit message (Collapse)AuthorAge
* filter: allow for cleanup hook for filter typesJason A. Donenfeld2014-01-14
| | | | | | | | | | | | At some point, we're going to want to do lazy deallocation of filters. For example, if we implement lua, we'll want to load the lua runtime once for each filter, even if that filter is called many times. Similarly, for persistent exec filters, we'll want to load it once, despite many open_filter and close_filter calls, and only reap the child process at the end of the cgit process. For this reason, we add here a cleanup function that is called at the end of cgit's main(). Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* filter: introduce "filter type" prefixJohn Keeping2014-01-14
| | | | | | | | This allows different filter implementations to be specified in the configuration file. Currently only "exec" is supported, but it may now be specified either with or without the "exec:" prefix. Signed-off-by: John Keeping <john@keeping.me.uk>
* filter: add interface layerJohn Keeping2014-01-14
| | | | | | | | | | | | | | 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 <john@keeping.me.uk>
* filter: add fprintf_filter functionJohn Keeping2014-01-14
| | | | | | | | This stops the code in cgit.c::print_repo needing to inspect the cgit_filter structure, meaning that we can abstract out different filter types that will have different fields that need to be printed. Signed-off-by: John Keeping <john@keeping.me.uk>
* filter: pass extra arguments via cgit_open_filterJohn Keeping2014-01-12
| | | | | | | | | This avoids poking into the filter data structure at various points in the code. We rely on the fact that the number of arguments is fixed based on the filter type (set in cgit_new_filter) and that the call sites all know which filter type they're using. Signed-off-by: John Keeping <john@keeping.me.uk>
* filter: split filter functions into their own fileJason A. Donenfeld2014-01-10
A first step for more interesting things. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>