Diff options
| -rw-r--r-- | source/filter.c | 12 | |
| -rw-r--r-- | source/html.c | 5 | |
| -rw-r--r-- | source/html.h | 2 |
3 files changed, 4 insertions, 15 deletions
diff --git a/source/filter.c b/source/filter.c index 367074f..c33e9bc 100644 --- a/source/filter.c +++ b/source/filter.c @@ -263,19 +263,9 @@ static int script_html_url_arg(lua_State *lua_state) return emit_unfiltered(lua_state, html_url_arg); } -/* - * html_include returns whether it found the file, and calling it through a - * pointer that claims it returns nothing would be undefined, so the result is - * dropped in a wrapper of the right shape. - */ -static void include_and_discard_result(const char *filename) -{ - html_include(filename); -} - static int script_html_include(lua_State *lua_state) { - return emit_unfiltered(lua_state, include_and_discard_result); + return emit_unfiltered(lua_state, html_include); } static const struct { diff --git a/source/html.c b/source/html.c index ec82ff4..48f7a88 100644 --- a/source/html.c +++ b/source/html.c @@ -524,7 +524,7 @@ void html_link_close(void) html("</a>"); } -int html_include(const char *filename) +void html_include(const char *filename) { FILE *f; char buf[4096]; @@ -532,12 +532,11 @@ int html_include(const char *filename) if (!(f = fopen(filename, "r"))) { fprintf(stderr, "[cgit] Unable to include %s: %s (%d)\n", filename, strerror(errno), errno); - return -1; + return; } while ((len = fread(buf, 1, sizeof(buf), f)) > 0) html_raw(buf, len); fclose(f); - return 0; } void http_parse_querystring(const char *txt, void (*fn)(const char *name, const char *value)) diff --git a/source/html.h b/source/html.h index cc87566..e962a53 100644 --- a/source/html.h +++ b/source/html.h @@ -96,7 +96,7 @@ extern void html_option(const char *value, const char *text, const char *selecte extern void html_intoption(int value, const char *text, int selected_value); extern void html_link_open(const char *url, const char *title, const char *class); extern void html_link_close(void); -extern int html_include(const char *filename); +extern void html_include(const char *filename); extern void http_parse_querystring(const char *txt, void (*fn)(const char *name, const char *value)); |
