about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-01-06 16:05:23 -0500
committerJune McEnroe <june@causal.agency>2019-01-06 16:05:23 -0500
commit2f70567b1cd34d9afbb0a2870ff4dbe34ac8a083 (patch)
tree8dbb48ecbe71c8923b541342da9cce84b225e060
parentAdd kfcgi rc file (diff)
downloadtorus-2f70567b1cd34d9afbb0a2870ff4dbe34ac8a083.tar.gz
torus-2f70567b1cd34d9afbb0a2870ff4dbe34ac8a083.zip
Use req.fieldmap
-rw-r--r--image.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/image.c b/image.c
index c94be5d..004b203 100644
--- a/image.c
+++ b/image.c
@@ -195,14 +195,11 @@ static void worker(void) {
 
 		uint32_t tileX = TileInitX;
 		uint32_t tileY = TileInitY;
-
-		for (size_t i = 0; i < req.fieldsz; ++i) {
-			if (req.fields[i].state != KPAIR_VALID) continue;
-			if (req.fields[i].keypos == KeyX) {
-				tileX = (uint32_t)req.fields[i].parsed.i % TileCols;
-			} else if (req.fields[i].keypos == KeyY) {
-				tileY = (uint32_t)req.fields[i].parsed.i % TileRows;
-			}
+		if (req.fieldmap[KeyX]) {
+			tileX = (uint32_t)req.fieldmap[KeyX]->parsed.i % TileCols;
+		}
+		if (req.fieldmap[KeyY]) {
+			tileY = (uint32_t)req.fieldmap[KeyY]->parsed.i % TileRows;
 		}
 
 		error = khttp_head(