[master] 6748169d8 vsl: Constify VSLQ_grouping[] array

Nils Goroll nils.goroll at uplex.de
Mon May 19 13:18:05 UTC 2025


commit 6748169d82767d1d2fa03c8b2676ad5f0ebf3f0e
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu May 15 11:00:42 2025 +0200

    vsl: Constify VSLQ_grouping[] array
    
    Just like VSL_tags[], both the array and the strings its members are
    pointing to should be immutable.

diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h
index 3b43f2cb4..7a44cd5f8 100644
--- a/include/vapi/vsl.h
+++ b/include/vapi/vsl.h
@@ -230,7 +230,7 @@ int VSL_List2Tags(const char *list, int l, VSL_tagfind_f *func, void *priv);
 	 *     -3: Syntax error
 	 */
 
-extern const char *VSLQ_grouping[VSL_g__MAX];
+extern const char *const VSLQ_grouping[VSL_g__MAX];
 	/*
 	 * Grouping mode to string array.
 	 */
diff --git a/lib/libvarnishapi/vsl_arg.c b/lib/libvarnishapi/vsl_arg.c
index 0fcdb4156..d7101c2ae 100644
--- a/lib/libvarnishapi/vsl_arg.c
+++ b/lib/libvarnishapi/vsl_arg.c
@@ -175,7 +175,7 @@ VSL_List2Tags(const char *list, int l, VSL_tagfind_f *func, void *priv)
 	return (t);
 }
 
-const char *VSLQ_grouping[VSL_g__MAX] = {
+const char *const VSLQ_grouping[VSL_g__MAX] = {
 	[VSL_g_raw]	= "raw",
 	[VSL_g_vxid]	= "vxid",
 	[VSL_g_request]	= "request",


More information about the varnish-commit mailing list