[master] 1ad310205 Give struct vpi_ref a magic

Nils Goroll nils.goroll at uplex.de
Mon Aug 15 13:38:06 UTC 2022


commit 1ad3102055d9df206d8ee0da611950b2d3c97fa3
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri May 7 17:48:52 2021 +0200

    Give struct vpi_ref a magic
    
    to be able to use our standard miniobj facilities on it, PAN_dump_struct
    in this case.
    
    As vpi_ref is static const in VGC, there is no real reason for magic
    checks other than that.

diff --git a/include/vcc_interface.h b/include/vcc_interface.h
index 394f308a0..83ef7f096 100644
--- a/include/vcc_interface.h
+++ b/include/vcc_interface.h
@@ -46,6 +46,8 @@ void v_noreturn_ VPI_Fail(const char *func, const char *file, int line,
  */
 
 struct vpi_ref {
+	unsigned	magic;
+#define VPI_REF_MAGIC	0xd955f567
 	unsigned	source;
 	unsigned	offset;
 	unsigned	line;
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index 442f4f9ca..f3f9a2d70 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -410,7 +410,7 @@ EmitCoordinates(const struct vcc *tl, struct vsb *vsb)
 				pos++;
 
 		}
-		VSB_printf(vsb, "  [%3u] = { %u, %8tu, %4u, %3u, ",
+		VSB_printf(vsb, "  [%3u] = { VPI_REF_MAGIC, %u, %8tu, %4u, %3u, ",
 		    t->cnt, sp->idx, t->b - sp->b, lin, pos + 1);
 		if (t->tok == CSRC)
 			VSB_cat(vsb, " \"C{\"},\n");


More information about the varnish-commit mailing list