[7.4] c5f616ce2 txt: New macros to work with strings

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Apr 4 14:30:10 UTC 2024


commit c5f616ce207d01b7a5432042ae99f07af47c695e
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