List for cgit developers and users
 help / color / mirror / Atom feed
From: Jason at zx2c4.com (Jason A. Donenfeld)
Subject: [PATCH 3/4] filter: wire up lua_filter to enable function
Date: Sat, 14 Oct 2017 16:17:49 +0200	[thread overview]
Message-ID: <20171014141750.14013-4-Jason@zx2c4.com> (raw)
In-Reply-To: <20171014141750.14013-1-Jason@zx2c4.com>

Signed-off-by: Jason A. Donenfeld <Jason at zx2c4.com>
---
 filter.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/filter.c b/filter.c
index 4deb4de..7b5bef5 100644
--- a/filter.c
+++ b/filter.c
@@ -353,6 +353,15 @@ static int close_lua_filter(struct cgit_filter *base)
 	return ret;
 }
 
+static int enable_lua_filter(struct cgit_filter *base, bool on)
+{
+	if (on)
+		hook_write(base, write_lua_filter);
+	else
+		unhook_write();
+	return 0;
+}
+
 static void fprintf_lua_filter(struct cgit_filter *base, FILE *f, const char *prefix)
 {
 	struct lua_filter *filter = (struct lua_filter *)base;
@@ -368,6 +377,7 @@ static struct cgit_filter *new_lua_filter(const char *cmd, int argument_count)
 	memset(filter, 0, sizeof(*filter));
 	filter->base.open = open_lua_filter;
 	filter->base.close = close_lua_filter;
+	filter->base.enable = enable_lua_filter;
 	filter->base.fprintf = fprintf_lua_filter;
 	filter->base.cleanup = cleanup_lua_filter;
 	filter->base.argument_count = argument_count;
-- 
2.14.2



  parent reply	other threads:[~2017-10-14 14:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-14 14:17 [PATCH 0/4] adding color to ui-blame Jason
2017-10-14 14:17 ` [PATCH 1/4] filter: add generic scafolding for temporarily disabling filter Jason
2017-10-14 14:17 ` [PATCH 2/4] filter: wire up exec_filter to enable function Jason
2017-10-14 14:17 ` Jason [this message]
2017-10-14 14:17 ` [PATCH 4/4] ui-blame: put source lines through filter Jason
2017-10-14 16:14 ` [PATCH 0/4] adding color to ui-blame john
2017-10-15 16:47   ` Jason
2017-10-15 17:04     ` whydoubt
2017-10-15 17:11       ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171014141750.14013-4-Jason@zx2c4.com \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).