[master] 804f323 make Tcheck a macro so assertions fail with more helpful __FILE__ and __LINE__

Nils Goroll nils.goroll at uplex.de
Mon Jul 4 13:38:06 CEST 2016


commit 804f32357cc3a853e010e1546b57d05478473800
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 b0c70de..ce56278 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1095,14 +1095,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