about summary refs log tree commit diff stats
path: root/cgit.c
diff options
context:
space:
mode:
authorJason A. Donenfeld2014-01-13 14:16:18 +0100
committerJason A. Donenfeld2014-01-14 02:00:07 +0100
commite83b51b4f6bd53efea0c772e6ecdf1c5605ca611 (patch)
tree695797e4de7c7e413730f7ab66246327e6fa0046 /cgit.c
parentfilter: allow for cleanup hook for filter types (diff)
downloadcgit-e83b51b4f6bd53efea0c772e6ecdf1c5605ca611.tar.gz
cgit-e83b51b4f6bd53efea0c772e6ecdf1c5605ca611.zip
filter: basic write hooking infrastructure
Filters can now call hook_write and unhook_write if they want to
redirect writing to stdout to a different function. This saves us from
potential file descriptor pipes and other less efficient mechanisms.

We do this instead of replacing the call in html_raw because some places
stdlib's printf functions are used (ui-patch or within git itself),
which has its own internal buffering, which makes it difficult to
interlace our function calls. So, we dlsym libc's write and then
override it in the link stage.

While we're at it, we move considerations of argument count into the
generic new filter handler.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'cgit.c')
-rw-r--r--cgit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c index 4f31e58..725fd65 100644 --- a/cgit.c +++ b/cgit.c
@@ -904,6 +904,8 @@ int main(int argc, const char **argv)
904 const char *path; 904 const char *path;
905 int err, ttl; 905 int err, ttl;
906 906
907 cgit_init_filters();
908
907 prepare_context(&ctx); 909 prepare_context(&ctx);
908 cgit_repolist.length = 0; 910 cgit_repolist.length = 0;
909 cgit_repolist.count = 0; 911 cgit_repolist.count = 0;