[master] b917fbe26 vcc: Constify struct token pointers

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Jan 11 11:40:06 UTC 2021


commit b917fbe26fb84901433fd4aaf09df2f15a97c196
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri Nov 15 10:25:13 2019 +0100

    vcc: Constify struct token pointers
    
    Refs #3134

diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c
index af75bbc04..98a92c650 100644
--- a/lib/libvcc/vcc_backend.c
+++ b/lib/libvcc/vcc_backend.c
@@ -131,8 +131,8 @@ Emit_UDS_Path(struct vcc *tl, struct vsb *vsb1,
  */
 
 static void
-vcc_Redef(struct vcc *tl, const char *redef, struct token **t_did,
-    struct token *t_field)
+vcc_Redef(struct vcc *tl, const char *redef, const struct token **t_did,
+    const struct token *t_field)
 {
 	if (*t_did != NULL) {
 		VSB_printf(tl->sb, "%s redefinition at:\n", redef);
@@ -152,8 +152,8 @@ static void
 vcc_ParseProbeSpec(struct vcc *tl, const struct symbol *sym, char **namep)
 {
 	struct fld_spec *fs;
-	struct token *t_field;
-	struct token *t_did = NULL, *t_window = NULL, *t_threshold = NULL;
+	const struct token *t_field;
+	const struct token *t_did = NULL, *t_window = NULL, *t_threshold = NULL;
 	struct token *t_initial = NULL;
 	unsigned window, threshold, initial, status;
 	char buf[32];
@@ -332,14 +332,14 @@ vcc_ParseProbe(struct vcc *tl)
 static void
 vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
 {
-	struct token *t_field;
-	struct token *t_val;
-	struct token *t_host = NULL;
-	struct token *t_port = NULL;
-	struct token *t_path = NULL;
-	struct token *t_hosthdr = NULL;
+	const struct token *t_field;
+	const struct token *t_val;
+	const struct token *t_host = NULL;
+	const struct token *t_port = NULL;
+	const struct token *t_path = NULL;
+	const struct token *t_hosthdr = NULL;
+	const struct token *t_did = NULL;
 	struct symbol *pb;
-	struct token *t_did = NULL;
 	struct fld_spec *fs;
 	struct inifin *ifp;
 	struct vsb *vsb1;
diff --git a/lib/libvcc/vcc_backend_util.c b/lib/libvcc/vcc_backend_util.c
index fa3583a72..eb6cc83ab 100644
--- a/lib/libvcc/vcc_backend_util.c
+++ b/lib/libvcc/vcc_backend_util.c
@@ -88,7 +88,7 @@ vcc_FldSpec(struct vcc *tl, const char *first, ...)
 }
 
 void
-vcc_IsField(struct vcc *tl, struct token **t, struct fld_spec *fs)
+vcc_IsField(struct vcc *tl, const struct token **t, struct fld_spec *fs)
 {
 	struct token *t_field;
 
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index 815b25918..dd94de055 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -307,7 +307,7 @@ void vcc_Backend_Init(struct vcc *tl);
 void vcc_ParseProbe(struct vcc *tl);
 void vcc_ParseBackend(struct vcc *tl);
 struct fld_spec * vcc_FldSpec(struct vcc *tl, const char *first, ...);
-void vcc_IsField(struct vcc *tl, struct token **t, struct fld_spec *fs);
+void vcc_IsField(struct vcc *tl, const struct token **t, struct fld_spec *fs);
 void vcc_FieldsOk(struct vcc *tl, const struct fld_spec *fs);
 
 /* vcc_compile.c */


More information about the varnish-commit mailing list