From: Jason at zx2c4.com (Jason A. Donenfeld)
Subject: [PATCH 1/4] filter: add generic scafolding for temporarily disabling filter
Date: Sat, 14 Oct 2017 16:17:47 +0200 [thread overview]
Message-ID: <20171014141750.14013-2-Jason@zx2c4.com> (raw)
In-Reply-To: <20171014141750.14013-1-Jason@zx2c4.com>
Signed-off-by: Jason A. Donenfeld <Jason at zx2c4.com>
---
cgit.h | 2 ++
filter.c | 9 +++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/cgit.h b/cgit.h
index 005ae63..8da69e7 100644
--- a/cgit.h
+++ b/cgit.h
@@ -61,6 +61,7 @@ typedef enum {
struct cgit_filter {
int (*open)(struct cgit_filter *, va_list ap);
int (*close)(struct cgit_filter *);
+ int (*enable)(struct cgit_filter *, bool on);
void (*fprintf)(struct cgit_filter *, FILE *, const char *prefix);
void (*cleanup)(struct cgit_filter *);
int argument_count;
@@ -376,6 +377,7 @@ extern int cgit_parse_snapshots_mask(const char *str);
extern int cgit_open_filter(struct cgit_filter *filter, ...);
extern int cgit_close_filter(struct cgit_filter *filter);
+extern int cgit_enable_filter(struct cgit_filter *filter, bool on);
extern void cgit_fprintf_filter(struct cgit_filter *filter, FILE *f, const char *prefix);
extern void cgit_exec_filter_init(struct cgit_exec_filter *filter, char *cmd, char **argv);
extern struct cgit_filter *cgit_new_filter(const char *cmd, filter_type filtertype);
diff --git a/filter.c b/filter.c
index 70f5b74..aa0027a 100644
--- a/filter.c
+++ b/filter.c
@@ -383,13 +383,18 @@ int cgit_close_filter(struct cgit_filter *filter)
return filter->close(filter);
}
+int cgit_enable_filter(struct cgit_filter *filter, bool on)
+{
+ if (!filter)
+ return 0;
+ return filter->enable(filter, on);
+}
+
void cgit_fprintf_filter(struct cgit_filter *filter, FILE *f, const char *prefix)
{
filter->fprintf(filter, f, prefix);
}
-
-
static const struct {
const char *prefix;
struct cgit_filter *(*ctor)(const char *cmd, int argument_count);
--
2.14.2
next prev 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 ` Jason [this message]
2017-10-14 14:17 ` [PATCH 2/4] filter: wire up exec_filter to enable function Jason
2017-10-14 14:17 ` [PATCH 3/4] filter: wire up lua_filter " Jason
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-2-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).