Mailing List Archive

[master] 1ad310205 Give struct vpi_ref a magic
commit 1ad3102055d9df206d8ee0da611950b2d3c97fa3
Author: Nils Goroll <nils.goroll@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");
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit