[master] 648a08570 panic: Bring back PAN_CheckMagic()

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Fri May 17 09:33:05 UTC 2024


commit 648a08570f335faf55bd41d5f88bd161707ef5bc
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri May 17 11:30:43 2024 +0200

    panic: Bring back PAN_CheckMagic()
    
    It turns out we still need it in a couple places.

diff --git a/bin/varnishd/cache/cache_varnishd.h b/bin/varnishd/cache/cache_varnishd.h
index 61d3145c9..add300e76 100644
--- a/bin/varnishd/cache/cache_varnishd.h
+++ b/bin/varnishd/cache/cache_varnishd.h
@@ -375,6 +375,14 @@ int PAN__DumpStruct(struct vsb *vsb, int block, int track, const void *ptr,
     const char *smagic, unsigned magic, const char *fmt, ...)
     v_printflike_(7,8);
 
+#define PAN_CheckMagic(vsb, ptr, exp)					\
+	do {								\
+		if ((ptr)->magic != (exp))				\
+			VSB_printf((vsb),				\
+			    "MAGIC at %p is 0x%08x (Should be: %s/0x%08x)\n", \
+			    ptr, (ptr)->magic, #exp, exp);		\
+	} while(0)
+
 #define PAN_dump_struct(vsb, ptr, magic, ...)		\
     PAN__DumpStruct(vsb, 1, 1, ptr, #magic, magic, __VA_ARGS__)
 


More information about the varnish-commit mailing list