[master] 4a5c7fd94 vdef: Add Tforeach() macro for txt

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Sep 24 07:21:08 UTC 2024


commit 4a5c7fd9472f577505f4b1b255dc2fc8078818bb
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Sep 23 11:02:11 2024 +0200

    vdef: Add Tforeach() macro for txt

diff --git a/include/vdef.h b/include/vdef.h
index b287e595f..95f342cb6 100644
--- a/include/vdef.h
+++ b/include/vdef.h
@@ -265,6 +265,7 @@ typedef struct {
 #define Tlen(t)		(pdiff((t).b, (t).e))
 #define Tstr(s)		(/*lint -e(446)*/ (txt){(s), (s) + strlen(s)})
 #define Tstrcmp(t, s)	(strncmp((t).b, (s), Tlen(t)))
+#define Tforeach(c, t)	for ((c) = (t).b; (c) < (t).e; (c)++)
 
 /* #3020 dummy definitions until PR is merged*/
 #define LIKELY(x)	(x)


More information about the varnish-commit mailing list