diff options
| author | 2014-01-13 11:56:50 (JST) | |
|---|---|---|
| committer | 2014-01-14 10:00:07 (JST) | |
| commit | 800380dde797ae35d738a644acdae2fabb9a0d44 (patch) | |
| tree | 4770bb2a3eb10021f5d527200ad61a2659a78bea /ui-commit.c | |
| parent | f43b228d0bca5791be98ff3fbb2f8743219635b6 (diff) | |
| download | cgit-800380dde797ae35d738a644acdae2fabb9a0d44.zip cgit-800380dde797ae35d738a644acdae2fabb9a0d44.tar.gz | |
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 <Jason@zx2c4.com>
Diffstat (limited to 'ui-commit.c')
| -rw-r--r-- | ui-commit.c | 18 |
1 files changed, 6 insertions, 12 deletions
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) | |||
| 107 | } | 107 | } |
| 108 | html("</table>\n"); | 108 | html("</table>\n"); |
| 109 | html("<div class='commit-subject'>"); | 109 | html("<div class='commit-subject'>"); |
| 110 | if (ctx.repo->commit_filter) | 110 | cgit_open_filter(ctx.repo->commit_filter); |
| 111 | cgit_open_filter(ctx.repo->commit_filter); | ||
| 112 | html_txt(info->subject); | 111 | html_txt(info->subject); |
| 113 | if (ctx.repo->commit_filter) | 112 | cgit_close_filter(ctx.repo->commit_filter); |
| 114 | cgit_close_filter(ctx.repo->commit_filter); | ||
| 115 | show_commit_decorations(commit); | 113 | show_commit_decorations(commit); |
| 116 | html("</div>"); | 114 | html("</div>"); |
| 117 | html("<div class='commit-msg'>"); | 115 | html("<div class='commit-msg'>"); |
| 118 | if (ctx.repo->commit_filter) | 116 | cgit_open_filter(ctx.repo->commit_filter); |
| 119 | cgit_open_filter(ctx.repo->commit_filter); | ||
| 120 | html_txt(info->msg); | 117 | html_txt(info->msg); |
| 121 | if (ctx.repo->commit_filter) | 118 | cgit_close_filter(ctx.repo->commit_filter); |
| 122 | cgit_close_filter(ctx.repo->commit_filter); | ||
| 123 | html("</div>"); | 119 | html("</div>"); |
| 124 | if (notes.len != 0) { | 120 | if (notes.len != 0) { |
| 125 | html("<div class='notes-header'>Notes</div>"); | 121 | html("<div class='notes-header'>Notes</div>"); |
| 126 | html("<div class='notes'>"); | 122 | html("<div class='notes'>"); |
| 127 | if (ctx.repo->commit_filter) | 123 | cgit_open_filter(ctx.repo->commit_filter); |
| 128 | cgit_open_filter(ctx.repo->commit_filter); | ||
| 129 | html_txt(notes.buf); | 124 | html_txt(notes.buf); |
| 130 | if (ctx.repo->commit_filter) | 125 | cgit_close_filter(ctx.repo->commit_filter); |
| 131 | cgit_close_filter(ctx.repo->commit_filter); | ||
| 132 | html("</div>"); | 126 | html("</div>"); |
| 133 | html("<div class='notes-footer'></div>"); | 127 | html("<div class='notes-footer'></div>"); |
| 134 | } | 128 | } |
