summary refs log tree commit diff
path: root/networks.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-07-11 18:07:33 -0400
committerJune McEnroe <june@causal.agency>2020-07-11 18:07:33 -0400
commit5d857422687068526d6477073ef83630ffcf0c1e (patch)
tree0ccc0a277ca4166bdd0d007bf7bee1f6a4393bab /networks.c
parentHandle KCGI_EXIT and call khttp_fcgi_free (diff)
downloadscooper-5d857422687068526d6477073ef83630ffcf0c1e.tar.gz
scooper-5d857422687068526d6477073ef83630ffcf0c1e.zip
Clean up page handlers
Diffstat (limited to 'networks.c')
-rw-r--r--networks.c12
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);
 }
-09-16 13:46:10 -0400'>2019-09-16Add The Just CityJune McEnroe 2019-09-12Only GET the final redirect locationJune McEnroe 2019-09-12Consume entire bodyJune McEnroe 2019-09-10Add title -v flagJune McEnroe 2019-09-10Use curl error bufferJune McEnroe 2019-09-10Set Accept-Encoding in titleJune McEnroe 2019-09-08Set title User-AgentJune McEnroe 2019-09-07Add -x flag to titleJune McEnroe 2019-09-07Ignore SIGPIPE in relayJune McEnroe 2019-09-07Add A Memory Called EmpireJune McEnroe 2019-09-05Handle lack of Content-TypeJune McEnroe 2019-09-05Use CURLINFO_CONTENT_TYPEJune McEnroe 2019-09-05Decode entities in titlesJune McEnroe 2019-09-05Print title as soon as it's availableJune McEnroe 2019-09-05Use CURL_PREFIX to set flagsJune McEnroe 2019-09-05Add titleJune McEnroe 2019-09-04Add Avorter n'est pas tuerJune McEnroe 2019-08-29Unset executable on shell scriptsJune McEnroe 2019-08-29Add long-missing setopt to bin.7June McEnroe 2019-08-29Add editJune McEnroe