[master] cf80fe68a vcc: Kill unused parameter
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Tue Nov 24 14:26:10 UTC 2020
commit cf80fe68a546df1f639134a7306a095a0023379f
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Tue Nov 24 10:11:03 2020 +0100
vcc: Kill unused parameter
And with that we know for sure that we always have null-terminated
VCL sources.
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index f3e5b3b0b..6deaff9e4 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -506,18 +506,17 @@ EmitStruct(const struct vcc *tl)
/*--------------------------------------------------------------------*/
static struct source *
-vcc_new_source(const char *b, const char *e, const char *name)
+vcc_new_source(const char *src, const char *name)
{
struct source *sp;
- if (e == NULL)
- e = strchr(b, '\0');
+ AN(src);
+ AN(name);
sp = calloc(1, sizeof *sp);
- assert(sp != NULL);
- sp->name = strdup(name);
- AN(sp->name);
- sp->b = b;
- sp->e = e;
+ AN(sp);
+ REPLACE(sp->name, name);
+ sp->b = src;
+ sp->e = strchr(src, '\0');
return (sp);
}
@@ -557,7 +556,7 @@ vcc_file_source(const struct vcc *tl, const char *fn)
free(fnp);
return (NULL);
}
- sp = vcc_new_source(f, NULL, fnp);
+ sp = vcc_new_source(f, fnp);
free(fnp);
sp->freeit = f;
return (sp);
@@ -694,7 +693,7 @@ vcc_CompileSource(struct vcc *tl, struct source *sp, const char *jfile)
return (NULL);
/* Register and lex the builtin VCL */
- sp = vcc_new_source(tl->builtin_vcl, NULL, "Builtin");
+ sp = vcc_new_source(tl->builtin_vcl, "Builtin");
assert(sp != NULL);
VTAILQ_INSERT_TAIL(&tl->sources, sp, list);
sp->idx = tl->nsources++;
@@ -818,7 +817,7 @@ VCC_Compile(struct vcc *tl, struct vsb **sb,
AN(ofile);
AN(jfile);
if (vclsrc != NULL)
- sp = vcc_new_source(vclsrc, NULL, vclsrcfile);
+ sp = vcc_new_source(vclsrc, vclsrcfile);
else
sp = vcc_file_source(tl, vclsrcfile);
More information about the varnish-commit
mailing list