From 800380dde797ae35d738a644acdae2fabb9a0d44 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 13 Jan 2014 03:56:50 +0100 Subject: filter: return on null filter from open and close So that we don't have to include the if(filter) open_filter(filter) block everywhere, we introduce the guard in the function itself. This should simplify quite a bit of code. Signed-off-by: Jason A. Donenfeld --- ui-commit.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'ui-commit.c') diff --git a/ui-commit.c b/ui-commit.c index aa1892f..5ac79c0 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -107,28 +107,22 @@ void cgit_print_commit(char *hex, const char *prefix) } html("\n"); html("
"); - if (ctx.repo->commit_filter) - cgit_open_filter(ctx.repo->commit_filter); + cgit_open_filter(ctx.repo->commit_filter); html_txt(info->subject); - if (ctx.repo->commit_filter) - cgit_close_filter(ctx.repo->commit_filter); + cgit_close_filter(ctx.repo->commit_filter); show_commit_decorations(commit); html("
"); html("
"); - if (ctx.repo->commit_filter) - cgit_open_filter(ctx.repo->commit_filter); + cgit_open_filter(ctx.repo->commit_filter); html_txt(info->msg); - if (ctx.repo->commit_filter) - cgit_close_filter(ctx.repo->commit_filter); + cgit_close_filter(ctx.repo->commit_filter); html("
"); if (notes.len != 0) { html("
Notes
"); html("
"); - if (ctx.repo->commit_filter) - cgit_open_filter(ctx.repo->commit_filter); + cgit_open_filter(ctx.repo->commit_filter); html_txt(notes.buf); - if (ctx.repo->commit_filter) - cgit_close_filter(ctx.repo->commit_filter); + cgit_close_filter(ctx.repo->commit_filter); html("
"); html(""); } -- cgit v1.2.3-24-g4f1b