[master] 6d5aa36cc cache_ban: refactor ban_iter

Nils Goroll nils.goroll at uplex.de
Wed Feb 26 13:41:06 UTC 2025


commit 6d5aa36cc13f0d09211ffa74e68d7ca607d921d2
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Feb 26 11:29:07 2025 +0100

    cache_ban: refactor ban_iter

diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index 0c6a6a2de..d611445d6 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -220,6 +220,7 @@ ban_get_lump(const uint8_t **bs)
 static void
 ban_iter(const uint8_t **bs, struct ban_test *bt)
 {
+	const void *lump;
 	uint64_t dtmp;
 
 	memset(bt, 0, sizeof *bt);
@@ -229,15 +230,14 @@ ban_iter(const uint8_t **bs, struct ban_test *bt)
 		bt->arg1_spec = (const char *)*bs;
 		(*bs) += (*bs)[0] + 2;
 	}
+	lump = ban_get_lump(bs);
+	bt->oper = *(*bs)++;
 	if (BANS_HAS_ARG2_DOUBLE(bt->arg1)) {
-		dtmp = vbe64dec(ban_get_lump(bs));
-		bt->oper = *(*bs)++;
-
+		dtmp = vbe64dec(lump);
 		memcpy(&bt->arg2_double, &dtmp, sizeof dtmp);
 		return;
 	}
-	bt->arg2 = ban_get_lump(bs);
-	bt->oper = *(*bs)++;
+	bt->arg2 = lump;
 	if (BANS_HAS_ARG2_SPEC(bt->oper))
 		bt->arg2_spec = ban_get_lump(bs);
 }


More information about the varnish-commit mailing list