[master] 17d773c38 Revert "vav: Treat a trailing comma as a separator"
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Fri Jul 2 17:36:04 UTC 2021
commit 17d773c384b70b76d7904bfd22dc4cd0f0756623
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Fri Jul 2 19:34:19 2021 +0200
Revert "vav: Treat a trailing comma as a separator"
This reverts commit d3df1f64014bb7d6a8898a0b9f9d84e3f4dc11fb.
I didn't mean to push it, it predates VAV's test driver.
diff --git a/lib/libvarnish/vav.c b/lib/libvarnish/vav.c
index 8679b087c..a25ed58fc 100644
--- a/lib/libvarnish/vav.c
+++ b/lib/libvarnish/vav.c
@@ -143,12 +143,11 @@ VAV_ParseTxt(const char *b, const char *e, int *argc, int flag)
char **argv;
const char *p;
int nargv, largv;
- int i, quote, more;
+ int i, quote;
AN(b);
if (e == NULL)
e = strchr(b, '\0');
- more = 0;
nargv = 1;
largv = 16;
argv = calloc(largv, sizeof *argv);
@@ -162,7 +161,6 @@ VAV_ParseTxt(const char *b, const char *e, int *argc, int flag)
}
if ((flag & ARGV_COMMENT) && *b == '#')
break;
- more = 0;
if (*b == '"' && !(flag & ARGV_NOESC)) {
p = ++b;
quote = 1;
@@ -187,10 +185,8 @@ VAV_ParseTxt(const char *b, const char *e, int *argc, int flag)
if (!quote) {
if (b >= e || isspace(*b))
break;
- if ((flag & ARGV_COMMA) && *b == ',') {
- more = 1;
+ if ((flag & ARGV_COMMA) && *b == ',')
break;
- }
b++;
continue;
}
@@ -202,8 +198,7 @@ VAV_ParseTxt(const char *b, const char *e, int *argc, int flag)
argv[0] = err_missing_quote;
return (argv);
}
- /* Ensure 1 slot for the new argument plus 1 more */
- if (nargv + 2 >= largv) {
+ if (nargv + 1 >= largv) {
argv = realloc(argv, sizeof (*argv) * (largv += largv));
assert(argv != NULL);
}
@@ -219,12 +214,6 @@ VAV_ParseTxt(const char *b, const char *e, int *argc, int flag)
if (b < e)
b++;
}
- if (more) {
- AN(flag & ARGV_COMMA);
- argv[nargv] = strdup("");
- assert(argv[nargv] != NULL);
- nargv++;
- }
argv[nargv] = NULL;
if (argc != NULL)
*argc = nargv;
More information about the varnish-commit
mailing list