From mboxrd@z Thu Jan 1 00:00:00 1970 From: cgit at cryptocrack.de (Lukas Fleischer) Date: Mon, 13 Jan 2014 09:39:04 +0100 Subject: [PATCH 06/12] filter: add preliminary lua support In-Reply-To: <1389586279-23724-7-git-send-email-Jason@zx2c4.com> References: <1389586279-23724-1-git-send-email-Jason@zx2c4.com> <1389586279-23724-7-git-send-email-Jason@zx2c4.com> Message-ID: <20140113083904.1499.86457@typhoon.lan> On Mon, 13 Jan 2014 at 05:11:13, Jason A. Donenfeld wrote: > Signed-off-by: Jason A. Donenfeld > --- > cgit.h | 2 +- > cgit.mk | 13 ++- > filter.c | 284 ++++++++++++++++++++++++++++++++++++++++++++++++--------------- > 3 files changed, 230 insertions(+), 69 deletions(-) > > [...] > +static ssize_t write_lua_filter(struct cgit_filter *base, const void *buf, size_t count) > +{ > + struct lua_filter *filter = (struct lua_filter *) base; > + > + lua_getglobal(filter->lua_state, "filter_write"); > + lua_pushlstring(filter->lua_state, buf, count); > + if (lua_pcall(filter->lua_state, 1, 0, 0)) { > + errno = EPROTO; Just noticed that this also breaks compilation under OpenBSD: ../filter.c:199: error: 'EPROTO' undeclared (first use in this function) The error number seems to be part of POSIX, though, so not sure if we should care about OpenBSD being non-compliant here. > + return -1; > + } > + return count; > +} > [...]