From: phk Date: Sun, 22 Jun 2008 22:00:02 +0000 (+0000) Subject: Macroize the method function arguments X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c978f0f5792aa6cb87957772ee7930e8de5b99be;p=varnish Macroize the method function arguments git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2777 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishtest/vtc.c b/varnish-cache/bin/varnishtest/vtc.c index 6b73271f..0f314f17 100644 --- a/varnish-cache/bin/varnishtest/vtc.c +++ b/varnish-cache/bin/varnishtest/vtc.c @@ -172,7 +172,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv) } assert(cp->cmd != NULL); - cp->cmd(token_s, priv); + cp->cmd(token_s, priv, cmd); } } @@ -185,7 +185,7 @@ reset_cmds(const struct cmds *cmd) { for (; cmd->name != NULL; cmd++) - cmd->cmd(NULL, NULL); + cmd->cmd(NULL, NULL, NULL); } /********************************************************************** @@ -193,10 +193,11 @@ reset_cmds(const struct cmds *cmd) */ static void -cmd_test(char **av, void *priv) +cmd_test(CMD_ARGS) { (void)priv; + (void)cmd; if (av == NULL) return; @@ -212,11 +213,12 @@ cmd_test(char **av, void *priv) */ void -cmd_delay(char **av, void *priv) +cmd_delay(CMD_ARGS) { double f; (void)priv; + (void)cmd; if (av == NULL) return; AN(av[1]); @@ -234,9 +236,10 @@ cmd_delay(char **av, void *priv) */ void -cmd_dump(char **av, void *priv) +cmd_dump(CMD_ARGS) { + (void)cmd; if (av == NULL) return; printf("cmd_dump(%p)\n", priv); diff --git a/varnish-cache/bin/varnishtest/vtc.h b/varnish-cache/bin/varnishtest/vtc.h index 75464d3a..0c0751fa 100644 --- a/varnish-cache/bin/varnishtest/vtc.h +++ b/varnish-cache/bin/varnishtest/vtc.h @@ -26,10 +26,12 @@ * $Id$ */ -typedef void cmd_f(char **av, void *priv); - struct vsb; struct vtclog; +struct cmds; + +#define CMD_ARGS char **av, void *priv, const struct cmds *cmd +typedef void cmd_f(CMD_ARGS); struct cmds { const char *name; diff --git a/varnish-cache/bin/varnishtest/vtc_client.c b/varnish-cache/bin/varnishtest/vtc_client.c index d9574606..7349be61 100644 --- a/varnish-cache/bin/varnishtest/vtc_client.c +++ b/varnish-cache/bin/varnishtest/vtc_client.c @@ -161,11 +161,12 @@ client_run(struct client *c) */ void -cmd_client(char **av, void *priv) +cmd_client(CMD_ARGS) { struct client *c, *c2; (void)priv; + (void)cmd; if (av == NULL) { /* Reset and free */ diff --git a/varnish-cache/bin/varnishtest/vtc_http.c b/varnish-cache/bin/varnishtest/vtc_http.c index 62327538..def5f93a 100644 --- a/varnish-cache/bin/varnishtest/vtc_http.c +++ b/varnish-cache/bin/varnishtest/vtc_http.c @@ -116,13 +116,14 @@ cmd_var_resolve(struct http *hp, char *spec) } static void -cmd_http_expect(char **av, void *priv) +cmd_http_expect(CMD_ARGS) { struct http *hp; char *lhs; char *cmp; char *rhs; + (void)cmd; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); assert(!strcmp(av[0], "expect")); av++; @@ -305,10 +306,11 @@ http_rxhdr(struct http *hp) */ static void -cmd_http_rxresp(char **av, void *priv) +cmd_http_rxresp(CMD_ARGS) { struct http *hp; + (void)cmd; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(hp->client); assert(!strcmp(av[0], "rxresp")); @@ -329,7 +331,7 @@ cmd_http_rxresp(char **av, void *priv) */ static void -cmd_http_txresp(char **av, void *priv) +cmd_http_txresp(CMD_ARGS) { struct http *hp; struct vsb *vsb; @@ -341,6 +343,7 @@ cmd_http_txresp(char **av, void *priv) const char *nl = "\r\n"; int l; + (void)cmd; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AZ(hp->client); assert(!strcmp(av[0], "txresp")); @@ -408,10 +411,11 @@ cmd_http_txresp(char **av, void *priv) */ static void -cmd_http_rxreq(char **av, void *priv) +cmd_http_rxreq(CMD_ARGS) { struct http *hp; + (void)cmd; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AZ(hp->client); assert(!strcmp(av[0], "rxreq")); @@ -432,7 +436,7 @@ cmd_http_rxreq(char **av, void *priv) */ static void -cmd_http_txreq(char **av, void *priv) +cmd_http_txreq(CMD_ARGS) { struct http *hp; struct vsb *vsb; @@ -444,6 +448,7 @@ cmd_http_txreq(char **av, void *priv) const char *nl = "\r\n"; int l; + (void)cmd; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(hp->client); assert(!strcmp(av[0], "txreq")); diff --git a/varnish-cache/bin/varnishtest/vtc_server.c b/varnish-cache/bin/varnishtest/vtc_server.c index d275517e..026296a0 100644 --- a/varnish-cache/bin/varnishtest/vtc_server.c +++ b/varnish-cache/bin/varnishtest/vtc_server.c @@ -203,11 +203,12 @@ cmd_server_genvcl(struct vsb *vsb) */ void -cmd_server(char **av, void *priv) +cmd_server(CMD_ARGS) { struct server *s, *s2; (void)priv; + (void)cmd; if (av == NULL) { /* Reset and free */ diff --git a/varnish-cache/bin/varnishtest/vtc_stats.c b/varnish-cache/bin/varnishtest/vtc_stats.c index eb23289c..1b84632d 100644 --- a/varnish-cache/bin/varnishtest/vtc_stats.c +++ b/varnish-cache/bin/varnishtest/vtc_stats.c @@ -32,8 +32,8 @@ #include "vtc.h" void -cmd_stats(char **av, void *priv) +cmd_stats(CMD_ARGS) { - cmd_dump(av, priv); + cmd_dump(av, priv, cmd); } diff --git a/varnish-cache/bin/varnishtest/vtc_varnish.c b/varnish-cache/bin/varnishtest/vtc_varnish.c index 2075c830..bb290d2f 100644 --- a/varnish-cache/bin/varnishtest/vtc_varnish.c +++ b/varnish-cache/bin/varnishtest/vtc_varnish.c @@ -409,11 +409,12 @@ varnish_vclbackend(struct varnish *v, char *vcl) */ void -cmd_varnish(char **av, void *priv) +cmd_varnish(CMD_ARGS) { struct varnish *v, *v2; (void)priv; + (void)cmd; if (av == NULL) { /* Reset and free */