[PATCH 06/12] filter: add preliminary lua support

Lukas Fleischer cgit at cryptocrack.de
Mon Jan 13 09:39:04 CET 2014


On Mon, 13 Jan 2014 at 05:11:13, Jason A. Donenfeld wrote:
> Signed-off-by: Jason A. Donenfeld <Jason at zx2c4.com>
> ---
>  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;
> +}
> [...]


More information about the CGit mailing list