aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.mk
diff options
context:
space:
mode:
authorGravatar Jason A. Donenfeld <Jason@zx2c4.com>2014-01-13 22:16:18 (JST)
committerGravatar Jason A. Donenfeld <Jason@zx2c4.com>2014-01-14 10:00:07 (JST)
commite83b51b4f6bd53efea0c772e6ecdf1c5605ca611 (patch)
tree695797e4de7c7e413730f7ab66246327e6fa0046 /cgit.mk
parentd750c7a2c9bb83cfc47c0d74fcee61f0a5042aa9 (diff)
downloadcgit-e83b51b4f6bd53efea0c772e6ecdf1c5605ca611.zip
cgit-e83b51b4f6bd53efea0c772e6ecdf1c5605ca611.tar.gz
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.mk')
-rw-r--r--cgit.mk4
1 files changed, 3 insertions, 1 deletions
diff --git a/cgit.mk b/cgit.mk
index 19a76e7..9d6dea8 100644
--- a/cgit.mk
+++ b/cgit.mk
@@ -61,6 +61,8 @@ $(CGIT_VERSION_OBJS): $(CGIT_PREFIX)VERSION
61$(CGIT_VERSION_OBJS): EXTRA_CPPFLAGS = \ 61$(CGIT_VERSION_OBJS): EXTRA_CPPFLAGS = \
62 -DCGIT_VERSION='"$(CGIT_VERSION)"' 62 -DCGIT_VERSION='"$(CGIT_VERSION)"'
63 63
64CGIT_LIBS += -ldl
65
64 66
65# Git handles dependencies using ":=" so dependencies in CGIT_OBJ are not 67# Git handles dependencies using ":=" so dependencies in CGIT_OBJ are not
66# handled by that and we must handle them ourselves. 68# handled by that and we must handle them ourselves.
@@ -88,4 +90,4 @@ $(CGIT_OBJS): %.o: %.c GIT-CFLAGS $(CGIT_PREFIX)CGIT-CFLAGS $(missing_dep_dirs)
88 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $(CGIT_CFLAGS) $< 90 $(QUIET_CC)$(CC) -o $*.o -c $(dep_args) $(ALL_CFLAGS) $(EXTRA_CPPFLAGS) $(CGIT_CFLAGS) $<
89 91
90$(CGIT_PREFIX)cgit: $(CGIT_OBJS) GIT-LDFLAGS $(GITLIBS) 92$(CGIT_PREFIX)cgit: $(CGIT_OBJS) GIT-LDFLAGS $(GITLIBS)
91 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) 93 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) $(CGIT_LIBS)