aboutsummaryrefslogtreecommitdiffstats
path: root/filter.c
diff options
context:
space:
mode:
authorGravatar Jason A. Donenfeld <Jason@zx2c4.com>2014-01-14 07:54:28 (JST)
committerGravatar Jason A. Donenfeld <Jason@zx2c4.com>2014-01-14 10:00:07 (JST)
commitd3c0370a3f108121642d02bbd190ce676bb4772b (patch)
treed70c0af13c62257cf023a86e3656ba7620494a39 /filter.c
parent786609bd36c07b85dbf905fc8c36eba7132122d7 (diff)
downloadcgit-d3c0370a3f108121642d02bbd190ce676bb4772b.zip
cgit-d3c0370a3f108121642d02bbd190ce676bb4772b.tar.gz
filter: style tweaks
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'filter.c')
-rw-r--r--filter.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/filter.c b/filter.c
index aa36026..4d4acaf 100644
--- a/filter.c
+++ b/filter.c
@@ -79,11 +79,11 @@ static inline void unhook_write()
79 79
80static int open_exec_filter(struct cgit_filter *base, va_list ap) 80static int open_exec_filter(struct cgit_filter *base, va_list ap)
81{ 81{
82 struct cgit_exec_filter *filter = (struct cgit_exec_filter *) base; 82 struct cgit_exec_filter *filter = (struct cgit_exec_filter *)base;
83 int i; 83 int i;
84 84
85 for (i = 0; i < filter->base.argument_count; i++) 85 for (i = 0; i < filter->base.argument_count; i++)
86 filter->argv[i+1] = va_arg(ap, char *); 86 filter->argv[i + 1] = va_arg(ap, char *);
87 87
88 filter->old_stdout = chk_positive(dup(STDOUT_FILENO), 88 filter->old_stdout = chk_positive(dup(STDOUT_FILENO),
89 "Unable to duplicate STDOUT"); 89 "Unable to duplicate STDOUT");
@@ -105,7 +105,7 @@ static int open_exec_filter(struct cgit_filter *base, va_list ap)
105 105
106static int close_exec_filter(struct cgit_filter *base) 106static int close_exec_filter(struct cgit_filter *base)
107{ 107{
108 struct cgit_exec_filter *filter = (struct cgit_exec_filter *) base; 108 struct cgit_exec_filter *filter = (struct cgit_exec_filter *)base;
109 int i, exit_status; 109 int i, exit_status;
110 110
111 chk_non_negative(dup2(filter->old_stdout, STDOUT_FILENO), 111 chk_non_negative(dup2(filter->old_stdout, STDOUT_FILENO),
@@ -120,20 +120,20 @@ static int close_exec_filter(struct cgit_filter *base)
120 120
121done: 121done:
122 for (i = 0; i < filter->base.argument_count; i++) 122 for (i = 0; i < filter->base.argument_count; i++)
123 filter->argv[i+1] = NULL; 123 filter->argv[i + 1] = NULL;
124 return 0; 124 return 0;
125 125
126} 126}
127 127
128static void fprintf_exec_filter(struct cgit_filter *base, FILE *f, const char *prefix) 128static void fprintf_exec_filter(struct cgit_filter *base, FILE *f, const char *prefix)
129{ 129{
130 struct cgit_exec_filter *filter = (struct cgit_exec_filter *) base; 130 struct cgit_exec_filter *filter = (struct cgit_exec_filter *)base;
131 fprintf(f, "%sexec:%s\n", prefix, filter->cmd); 131 fprintf(f, "%sexec:%s\n", prefix, filter->cmd);
132} 132}
133 133
134static void cleanup_exec_filter(struct cgit_filter *base) 134static void cleanup_exec_filter(struct cgit_filter *base)
135{ 135{
136 struct cgit_exec_filter *filter = (struct cgit_exec_filter *) base; 136 struct cgit_exec_filter *filter = (struct cgit_exec_filter *)base;
137 if (filter->argv) { 137 if (filter->argv) {
138 free(filter->argv); 138 free(filter->argv);
139 filter->argv = NULL; 139 filter->argv = NULL;
@@ -188,7 +188,7 @@ static void error_lua_filter(struct lua_filter *filter)
188 188
189static ssize_t write_lua_filter(struct cgit_filter *base, const void *buf, size_t count) 189static ssize_t write_lua_filter(struct cgit_filter *base, const void *buf, size_t count)
190{ 190{
191 struct lua_filter *filter = (struct lua_filter *) base; 191 struct lua_filter *filter = (struct lua_filter *)base;
192 192
193 lua_getglobal(filter->lua_state, "filter_write"); 193 lua_getglobal(filter->lua_state, "filter_write");
194 lua_pushlstring(filter->lua_state, buf, count); 194 lua_pushlstring(filter->lua_state, buf, count);
@@ -246,7 +246,7 @@ static int html_url_arg_lua_filter(lua_State *lua_state)
246 246
247static void cleanup_lua_filter(struct cgit_filter *base) 247static void cleanup_lua_filter(struct cgit_filter *base)
248{ 248{
249 struct lua_filter *filter = (struct lua_filter *) base; 249 struct lua_filter *filter = (struct lua_filter *)base;
250 250
251 if (!filter->lua_state) 251 if (!filter->lua_state)
252 return; 252 return;
@@ -291,7 +291,7 @@ static int init_lua_filter(struct lua_filter *filter)
291 291
292static int open_lua_filter(struct cgit_filter *base, va_list ap) 292static int open_lua_filter(struct cgit_filter *base, va_list ap)
293{ 293{
294 struct lua_filter *filter = (struct lua_filter *) base; 294 struct lua_filter *filter = (struct lua_filter *)base;
295 int i; 295 int i;
296 296
297 if (init_lua_filter(filter)) 297 if (init_lua_filter(filter))
@@ -311,7 +311,7 @@ static int open_lua_filter(struct cgit_filter *base, va_list ap)
311 311
312static int close_lua_filter(struct cgit_filter *base) 312static int close_lua_filter(struct cgit_filter *base)
313{ 313{
314 struct lua_filter *filter = (struct lua_filter *) base; 314 struct lua_filter *filter = (struct lua_filter *)base;
315 int ret = 0; 315 int ret = 0;
316 316
317 lua_getglobal(filter->lua_state, "filter_close"); 317 lua_getglobal(filter->lua_state, "filter_close");
@@ -325,7 +325,7 @@ static int close_lua_filter(struct cgit_filter *base)
325 325
326static void fprintf_lua_filter(struct cgit_filter *base, FILE *f, const char *prefix) 326static void fprintf_lua_filter(struct cgit_filter *base, FILE *f, const char *prefix)
327{ 327{
328 struct lua_filter *filter = (struct lua_filter *) base; 328 struct lua_filter *filter = (struct lua_filter *)base;
329 fprintf(f, "%slua:%s\n", prefix, filter->script_file); 329 fprintf(f, "%slua:%s\n", prefix, filter->script_file);
330} 330}
331 331