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>
Этот коммит содержится в:
4
filter.c
4
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);
|
||||
}
|
||||
|
||||
|
Ссылка в новой задаче
Block a user