[4.1] 1efaa64 make Tcheck a macro so assertions fail with more helpful __FILE__ and __LINE__

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Fri Aug 12 11:50:11 CEST 2016


commit 1efaa649d13c7f979a07b04e837ad85d9546d332
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Jun 28 21:22:49 2016 +0200

    make Tcheck a macro so assertions fail with more helpful __FILE__ and __LINE__

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 9ae79d5..d64d007 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1076,14 +1076,11 @@ pdiff(const void *b, const void *e)
 	    ((unsigned)((const unsigned char *)e - (const unsigned char *)b));
 }
 
-static inline void
-Tcheck(const txt t)
-{
-
-	AN(t.b);
-	AN(t.e);
-	assert(t.b <= t.e);
-}
+#define Tcheck(t) do {						\
+		AN((t).b);					\
+		AN((t).e);					\
+		assert((t).b <= (t).e); 			\
+	} while(0)
 
 /*
  * unsigned length of a txt



More information about the varnish-commit mailing list