Commit 15b0bea3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Reverse constification of Argv functions. After cascading through all

the CLI functions we hit the fact that the evbuffer functions in libevent
are not properly constified.

It's better to deconst the error messages and just "let it be known" that
argv[0] is const (or NULL).



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@110 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent f7bf2ee9
......@@ -11,7 +11,7 @@
struct cli; /* NB: struct cli is opaque at this level. */
typedef void cli_func_t(struct cli*, const char **av, void *priv);
typedef void cli_func_t(struct cli*, char **av, void *priv);
struct cli_proto {
/* These must match the CLI_* macros in cli.h */
......
......@@ -3,8 +3,8 @@
*/
/* from libvarnish/argv.c */
void FreeArgv(const char **argv);
const char **ParseArgv(const char *s, int comment);
void FreeArgv(char **argv);
char **ParseArgv(const char *s, int comment);
/* Assert zero return value */
......
......@@ -96,10 +96,10 @@ BackSlashDecode(const char *s, const char *e)
return (p);
}
const char **
char **
ParseArgv(const char *s, int comment)
{
const char **argv;
char **argv;
const char *p;
int nargv, largv;
int i, quote;
......@@ -131,7 +131,7 @@ ParseArgv(const char *s, int comment)
if (*s == '\\') {
i = BackSlash(s, NULL);
if (i == 0) {
argv[0] = "Illegal backslash sequence";
argv[0] = (void*)(uintptr_t)"Illegal backslash sequence";
return (argv);
}
s += i;
......@@ -146,7 +146,7 @@ ParseArgv(const char *s, int comment)
if (*s == '"')
break;
if (*s == '\0') {
argv[0] = "Missing '\"'";
argv[0] = (void*)(uintptr_t)"Missing '\"'";
return (argv);
}
s++;
......@@ -164,12 +164,12 @@ ParseArgv(const char *s, int comment)
}
void
FreeArgv(const char **argv)
FreeArgv(char **argv)
{
int i;
for (i = 1; argv[i] != NULL; i++)
free((void *)(uintptr_t)argv[i]);
free(argv[i]);
free(argv);
}
......
......@@ -19,7 +19,7 @@
*/
void
cli_func_help(struct cli *cli, const char **av, void *priv)
cli_func_help(struct cli *cli, char **av, void *priv)
{
struct cli_proto *cp;
......@@ -41,7 +41,7 @@ cli_func_help(struct cli *cli, const char **av, void *priv)
void
cli_dispatch(struct cli *cli, struct cli_proto *clp, const char *line)
{
const char **av;
char **av;
unsigned u;
struct cli_proto *cp;
......
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