Commit 0cfc7187 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Namespace cleanup FooArgv -> VAV_Foo

parent a5f11476
......@@ -738,7 +738,7 @@ HSH_config(const char *h_arg)
const struct hash_slinger *hp;
ASSERT_MGT();
av = ParseArgv(h_arg, NULL, ARGV_COMMA);
av = VAV_Parse(h_arg, NULL, ARGV_COMMA);
AN(av);
if (av[0] != NULL)
......
......@@ -467,10 +467,10 @@ VRT_ban_string(struct sess *sp, const char *str)
int i;
(void)sp;
av = ParseArgv(str, NULL, ARGV_NOESC);
av = VAV_Parse(str, NULL, ARGV_NOESC);
if (av[0] != NULL) {
/* XXX: report error how ? */
FreeArgv(av);
VAV_Free(av);
return;
}
b = BAN_New();
......@@ -500,7 +500,7 @@ VRT_ban_string(struct sess *sp, const char *str)
BAN_Free(b);
else
BAN_Insert(b);
FreeArgv(av);
VAV_Free(av);
}
/*--------------------------------------------------------------------
......
......@@ -354,7 +354,7 @@ tweak_listen_address(struct cli *cli, const struct parspec *par,
return;
}
av = ParseArgv(arg, NULL, ARGV_COMMA);
av = VAV_Parse(arg, NULL, ARGV_COMMA);
if (av == NULL) {
cli_out(cli, "Parse error: out of memory");
cli_result(cli, CLIS_PARAM);
......@@ -363,13 +363,13 @@ tweak_listen_address(struct cli *cli, const struct parspec *par,
if (av[0] != NULL) {
cli_out(cli, "Parse error: %s", av[0]);
cli_result(cli, CLIS_PARAM);
FreeArgv(av);
VAV_Free(av);
return;
}
if (av[1] == NULL) {
cli_out(cli, "Empty listen address");
cli_result(cli, CLIS_PARAM);
FreeArgv(av);
VAV_Free(av);
return;
}
VTAILQ_INIT(&lsh);
......@@ -395,7 +395,7 @@ tweak_listen_address(struct cli *cli, const struct parspec *par,
}
free(ta);
}
FreeArgv(av);
VAV_Free(av);
if (cli != NULL && cli->result != CLIS_OK) {
clean_listen_sock_head(&lsh);
return;
......
......@@ -206,7 +206,7 @@ mgt_SHM_Init(const char *l_arg)
if (l_arg == NULL)
l_arg = "";
av = ParseArgv(l_arg, NULL, ARGV_COMMA);
av = VAV_Parse(l_arg, NULL, ARGV_COMMA);
AN(av);
if (av[0] != NULL)
ARGV_ERR("\t-l ...: %s", av[0]);
......@@ -253,7 +253,7 @@ mgt_SHM_Init(const char *l_arg)
if (*ap != NULL)
ARGV_ERR("\t-l ...: Too many sub-args\n");
FreeArgv(av);
VAV_Free(av);
size = s1 + s2;
ps = getpagesize();
......
......@@ -438,9 +438,9 @@ STV_Config(const char *spec)
p = strchr(spec, '=');
q = strchr(spec, ',');
if (p != NULL && (q == NULL || q > p)) {
av = ParseArgv(p + 1, NULL, ARGV_COMMA);
av = VAV_Parse(p + 1, NULL, ARGV_COMMA);
} else {
av = ParseArgv(spec, NULL, ARGV_COMMA);
av = VAV_Parse(spec, NULL, ARGV_COMMA);
p = NULL;
}
AN(av);
......
......@@ -185,7 +185,7 @@ tackle_warg(const char *argv)
char **av;
unsigned int u;
av = ParseArgv(argv, NULL, ARGV_COMMA);
av = VAV_Parse(argv, NULL, ARGV_COMMA);
AN(av);
if (av[0] != NULL)
......@@ -210,7 +210,7 @@ tackle_warg(const char *argv)
params->wthread_timeout = u;
}
}
FreeArgv(av);
VAV_Free(av);
}
/*--------------------------------------------------------------------*/
......
......@@ -244,7 +244,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv, struct vtclog *vl)
if (*p == '"')
break;
if (*p == '\\') {
p += BackSlash(p, q) - 1;
p += VAV_BackSlash(p, q) - 1;
q++;
} else {
if (*p == '\n')
......
......@@ -28,10 +28,10 @@
*
*/
void FreeArgv(char **argv);
char **ParseArgv(const char *s, int *argc, int flag);
char *BackSlashDecode(const char *s, const char *e);
int BackSlash(const char *s, char *res);
void VAV_Free(char **argv);
char **VAV_Parse(const char *s, int *argc, int flag);
char *VAV_BackSlashDecode(const char *s, const char *e);
int VAV_BackSlash(const char *s, char *res);
#define ARGV_COMMENT (1 << 0)
#define ARGV_COMMA (1 << 1)
#define ARGV_NOESC (1 << 2)
......@@ -26,13 +26,13 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* const char **ParseArgv(const char *s, int comment)
* const char **VAV_Parse(const char *s, int comment)
* Parse a command like line into an argv[]
* Index zero contains NULL or an error message
* "double quotes" and backslash substitution is handled.
*
* void FreeArgv(const char **argv)
* Free the result of ParseArgv()
* void VAV_Free(const char **argv)
* Free the result of VAV_Parse()
*
*/
......@@ -46,7 +46,7 @@
#include "libvarnish.h"
int
BackSlash(const char *s, char *res)
VAV_BackSlash(const char *s, char *res)
{
int r;
char c;
......@@ -102,7 +102,7 @@ BackSlash(const char *s, char *res)
}
char *
BackSlashDecode(const char *s, const char *e)
VAV_BackSlashDecode(const char *s, const char *e)
{
const char *q;
char *p, *r;
......@@ -119,7 +119,7 @@ BackSlashDecode(const char *s, const char *e)
*r++ = *q++;
continue;
}
i = BackSlash(q, r);
i = VAV_BackSlash(q, r);
q += i;
r++;
}
......@@ -131,7 +131,7 @@ static char err_invalid_backslash[] = "Invalid backslash sequence";
static char err_missing_quote[] = "Missing '\"'";
char **
ParseArgv(const char *s, int *argc, int flag)
VAV_Parse(const char *s, int *argc, int flag)
{
char **argv;
const char *p;
......@@ -163,7 +163,7 @@ ParseArgv(const char *s, int *argc, int flag)
}
while (1) {
if (*s == '\\' && !(flag & ARGV_NOESC)) {
i = BackSlash(s, NULL);
i = VAV_BackSlash(s, NULL);
if (i == 0) {
argv[0] = err_invalid_backslash;
return (argv);
......@@ -198,7 +198,7 @@ ParseArgv(const char *s, int *argc, int flag)
argv[nargv][s - p] = '\0';
nargv++;
} else {
argv[nargv++] = BackSlashDecode(p, s);
argv[nargv++] = VAV_BackSlashDecode(p, s);
}
if (*s != '\0')
s++;
......@@ -210,7 +210,7 @@ ParseArgv(const char *s, int *argc, int flag)
}
void
FreeArgv(char **argv)
VAV_Free(char **argv)
{
int i;
......@@ -224,7 +224,7 @@ FreeArgv(char **argv)
#include <printf.h>
static void
PrintArgv(char **argv)
VAV_Print(char **argv)
{
int i;
......@@ -241,8 +241,8 @@ Test(const char *str)
char **av;
printf("Test: <%V>\n", str);
av = ParseArgv(str, 0);
PrintArgv(av);
av = VAV_Parse(str, 0);
VAV_Print(av);
}
int
......
......@@ -323,11 +323,11 @@ cls_vlu(void *priv, const char *p)
return (0);
REPLACE(cli->cmd, p);
av = ParseArgv(p, NULL, 0);
av = VAV_Parse(p, NULL, 0);
AN(av);
if (av[0] != NULL) {
i = cls_vlu2(priv, av);
FreeArgv(av);
VAV_Free(av);
free(cli->cmd);
cli->cmd = NULL;
return (i);
......@@ -336,7 +336,7 @@ cls_vlu(void *priv, const char *p)
continue;
if (i < 3 || cli->auth == 0 || strcmp(av[i - 2], "<<")) {
i = cls_vlu2(priv, av);
FreeArgv(av);
VAV_Free(av);
free(cli->cmd);
cli->cmd = NULL;
return (i);
......@@ -363,7 +363,7 @@ cls_vlu(void *priv, const char *p)
cfd->argv[cfd->last_idx] = VSB_data(cfd->last_arg);
i = cls_vlu2(priv, cfd->argv);
cfd->argv[cfd->last_idx] = NULL;
FreeArgv(cfd->argv);
VAV_Free(cfd->argv);
cfd->argv = NULL;
free(cli->cmd);
cli->cmd = NULL;
......
......@@ -123,7 +123,7 @@ vsc_sf_arg(const struct VSM_data *vd, const char *opt)
vsc->sf_init = 1;
}
av = ParseArgv(opt, NULL, ARGV_COMMA);
av = VAV_Parse(opt, NULL, ARGV_COMMA);
AN(av);
if (av[0] != NULL) {
vd->diag(vd->priv, "Parse error: %s", av[0]);
......@@ -183,7 +183,7 @@ vsc_sf_arg(const struct VSM_data *vd, const char *opt)
}
}
}
FreeArgv(av);
VAV_Free(av);
return (1);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment