[master] 7a88cab9f vcc: make vgc probes actual pointers to compound literals
Nils Goroll
nils.goroll at uplex.de
Fri Nov 28 17:52:05 UTC 2025
commit 7a88cab9fe0ea567e3ceac9fa9a9cd7108e85504
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Fri Nov 28 18:47:25 2025 +0100
vcc: make vgc probes actual pointers to compound literals
This is one of the cases where arrays do not behave like pointers, but besides
the slightly more elaborate syntax I think a compound literal is what we
intended all along, just using the array syntax as a convenience.
Fixes #4410
Ref #4418
diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c
index 90d0f6bad..8feb20df4 100644
--- a/lib/libvcc/vcc_backend.c
+++ b/lib/libvcc/vcc_backend.c
@@ -214,7 +214,8 @@ vcc_ParseProbeSpec(struct vcc *tl, const struct symbol *sym, char **namep)
bprintf(buf, "vgc_probe__%d", tl->nprobe++);
name = buf;
}
- Fh(tl, 0, "static const struct vrt_backend_probe %s[] = {{\n", name);
+ Fh(tl, 0, "static const struct vrt_backend_probe * const %s =\n", name);
+ Fh(tl, 0, " &(const struct vrt_backend_probe){\n");
Fh(tl, 0, "\t.magic = VRT_BACKEND_PROBE_MAGIC,\n");
if (sym != NULL) {
Fh(tl, 0, "\t.vcl_name = \"%s\",\n", sym->name);
@@ -339,7 +340,7 @@ vcc_ParseProbeSpec(struct vcc *tl, const struct symbol *sym, char **namep)
if (status > 0)
Fh(tl, 0, "\t.exp_status = %u,\n", status);
Fh(tl, 0, "\t.exp_close = %u,\n", exp_close);
- Fh(tl, 0, "}};\n");
+ Fh(tl, 0, "};\n");
SkipToken(tl, '}');
}
More information about the varnish-commit
mailing list