[master] 7c684d90f txt: New macros to work with strings

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Apr 4 14:29:11 UTC 2024


commit 7c684d90f21eda97afeeeb9712044446ca4696b7
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Wed Mar 27 15:19:01 2024 +0100

    txt: New macros to work with strings

diff --git a/include/vdef.h b/include/vdef.h
index 2df601119..a321407d7 100644
--- a/include/vdef.h
+++ b/include/vdef.h
@@ -263,6 +263,8 @@ typedef struct {
 
 #define Tcheck(t)	do { (void)pdiff((t).b, (t).e); } while (0)
 #define Tlen(t)		(pdiff((t).b, (t).e))
+#define Tstr(s)		((txt){(s), (s) + strlen(s)})
+#define Tstrcmp(t, s)	(strncmp((t).b, (s), Tlen(t)))
 
 /* #3020 dummy definitions until PR is merged*/
 #define LIKELY(x)	(x)


More information about the varnish-commit mailing list