diff options
author | June McEnroe <june@causal.agency> | 2020-07-11 18:07:33 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-07-11 18:07:33 -0400 |
commit | 5d857422687068526d6477073ef83630ffcf0c1e (patch) | |
tree | 0ccc0a277ca4166bdd0d007bf7bee1f6a4393bab /networks.c | |
parent | Handle KCGI_EXIT and call khttp_fcgi_free (diff) | |
download | scooper-5d857422687068526d6477073ef83630ffcf0c1e.tar.gz scooper-5d857422687068526d6477073ef83630ffcf0c1e.zip |
Clean up page handlers
Diffstat (limited to '')
-rw-r--r-- | networks.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/networks.c b/networks.c index 74b9ea2..4fcd476 100644 --- a/networks.c +++ b/networks.c @@ -57,6 +57,7 @@ enum kcgi_err pageNetworks(struct kreq *req) { || htmlNav(&html, scope); if (error) return error; + sqlite3_reset(stmt.networks); dbBindInt(stmt.networks, ":recent", pageRecent); enum State { @@ -68,8 +69,9 @@ enum kcgi_err pageNetworks(struct kreq *req) { int result; while (SQLITE_ROW == (result = sqlite3_step(stmt.networks))) { - const char *network = (const char *)sqlite3_column_text(stmt.networks, 0); - bool active = sqlite3_column_int(stmt.networks, 1); + int i = 0; + const char *network = sqlite3_column_text(stmt.networks, i++); + bool active = sqlite3_column_int(stmt.networks, i++); enum State prev = state; state = (active ? Active : Networks); @@ -98,9 +100,5 @@ enum kcgi_err pageNetworks(struct kreq *req) { if (error) break; } if (result != SQLITE_DONE) errx(EX_SOFTWARE, "%s", sqlite3_errmsg(db)); - sqlite3_reset(stmt.networks); - - return error - || htmlFooter(&html) - || khtml_close(&html); + return error || htmlFooter(&html) || khtml_close(&html); } |