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 --- filter.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'filter.c') diff --git a/filter.c b/filter.c index 3702585..7983737 100644 --- a/filter.c +++ b/filter.c @@ -351,6 +351,8 @@ int cgit_open_filter(struct cgit_filter *filter, ...) { int result; va_list ap; + if (!filter) + return 0; va_start(ap, filter); result = filter->open(filter, ap); va_end(ap); @@ -359,6 +361,8 @@ int cgit_open_filter(struct cgit_filter *filter, ...) int cgit_close_filter(struct cgit_filter *filter) { + if (!filter) + return 0; return filter->close(filter); } -- cgit v1.2.3-70-g09d2