From 07517ab158c84aa8af76769d8cd7613900fd7d0e Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 10 Jul 2006 09:47:56 +0000 Subject: [PATCH] Fix a bunch warnings, all cosmetic. I'm using __unused for now, if we need to use something different we can do a find/replace. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@396 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 3 ++- varnish-cache/bin/varnishd/cache_acceptor.c | 12 ++++++------ varnish-cache/bin/varnishd/cache_backend.c | 13 +++---------- varnish-cache/bin/varnishd/cache_ban.c | 2 +- varnish-cache/bin/varnishd/cache_expire.c | 10 ++++------ varnish-cache/bin/varnishd/cache_fetch.c | 12 ++++++------ varnish-cache/bin/varnishd/cache_http.c | 2 +- varnish-cache/bin/varnishd/cache_main.c | 1 + varnish-cache/bin/varnishd/cache_pass.c | 10 +++++----- varnish-cache/bin/varnishd/cache_pipe.c | 2 +- varnish-cache/bin/varnishd/cache_shmlog.c | 3 +-- varnish-cache/bin/varnishd/cache_shmlog.h | 6 ++++++ varnish-cache/bin/varnishd/cache_vcl.c | 8 ++++---- varnish-cache/bin/varnishd/cli_event.c | 2 +- varnish-cache/bin/varnishd/mgt.h | 3 +-- varnish-cache/bin/varnishd/mgt_child.c | 8 ++++---- varnish-cache/bin/varnishd/tcp.c | 1 + varnish-cache/bin/varnishd/varnishd.c | 2 +- 18 files changed, 49 insertions(+), 51 deletions(-) create mode 100644 varnish-cache/bin/varnishd/cache_shmlog.h diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index d5aca394..bd5086ee 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -241,6 +241,8 @@ void CacheInitPool(void); void DealWithSession(void *arg); /* cache_shmlog.c */ +#include "cache_shmlog.h" + void VSL_Init(void); #ifdef SHMLOGHEAD_MAGIC void VSLR(enum shmlogtag tag, unsigned id, const char *b, const char *e); @@ -251,7 +253,6 @@ void VSL(enum shmlogtag tag, unsigned id, const char *fmt, ...); assert(__LINE__ == 0); \ } while (0) #endif -extern struct varnish_stats *VSL_stats; /* cache_response.c */ void RES_Error(struct worker *w, struct sess *sp, int error, const char *msg); diff --git a/varnish-cache/bin/varnishd/cache_acceptor.c b/varnish-cache/bin/varnishd/cache_acceptor.c index c82852b5..1779acb0 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor.c +++ b/varnish-cache/bin/varnishd/cache_acceptor.c @@ -160,7 +160,7 @@ vca_write_obj(struct worker *w, struct sess *sp) /*--------------------------------------------------------------------*/ static void -vca_tick(int a, short b, void *c) +vca_tick(int a __unused, short b __unused, void *c __unused) { struct sess *sp, *sp2; time_t t; @@ -194,7 +194,7 @@ vca_callback(void *arg, int bad) } static void -pipe_f(int fd, short event, void *arg) +pipe_f(int fd, short event __unused, void *arg __unused) { struct sess *sp; int i; @@ -207,7 +207,7 @@ pipe_f(int fd, short event, void *arg) } static void -accept_f(int fd, short event, void *arg) +accept_f(int fd, short event __unused, void *arg __unused) { socklen_t l; struct sockaddr addr[2]; @@ -254,7 +254,7 @@ accept_f(int fd, short event, void *arg) } static void * -vca_main(void *arg) +vca_main(void *arg __unused) { unsigned u; struct event *ep; @@ -292,8 +292,8 @@ vca_main(void *arg) } event_base_loop(evb, 0); - - return ("FOOBAR"); + assert(0 == 1); + return (NULL); } /*--------------------------------------------------------------------*/ diff --git a/varnish-cache/bin/varnishd/cache_backend.c b/varnish-cache/bin/varnishd/cache_backend.c index 536f15ce..45f2aaa5 100644 --- a/varnish-cache/bin/varnishd/cache_backend.c +++ b/varnish-cache/bin/varnishd/cache_backend.c @@ -151,14 +151,11 @@ connect_to_backend(struct vbe_conn *vc, struct backend *bp) */ static void -vbe_rdp(int fd, short event, void *arg) +vbe_rdp(int fd, short event __unused, void *arg __unused) { struct vbe_conn *vc; int i; - (void)event; - (void)arg; - i = read(fd, &vc, sizeof vc); assert(i == sizeof vc); AZ(pthread_mutex_lock(&vbemtx)); @@ -181,13 +178,11 @@ vbe_rdp(int fd, short event, void *arg) */ static void -vbe_rdf(int fd, short event, void *arg) +vbe_rdf(int fd __unused, short event __unused, void *arg) { struct vbe_conn *vc; int j; - (void)event; - vc = arg; AZ(pthread_mutex_lock(&vbemtx)); if (vc->inuse) { @@ -207,12 +202,10 @@ vbe_rdf(int fd, short event, void *arg) /* Backend monitoring thread -----------------------------------------*/ static void * -vbe_main(void *priv) +vbe_main(void *priv __unused) { struct event pev; - (void)priv; - vbe_evb = event_init(); assert(vbe_evb != NULL); diff --git a/varnish-cache/bin/varnishd/cache_ban.c b/varnish-cache/bin/varnishd/cache_ban.c index 1a2777f9..91e6a47a 100644 --- a/varnish-cache/bin/varnishd/cache_ban.c +++ b/varnish-cache/bin/varnishd/cache_ban.c @@ -71,7 +71,7 @@ BAN_CheckObject(struct object *o, const char *url) } void -cli_func_url_purge(struct cli *cli, char **av, void *priv) +cli_func_url_purge(struct cli *cli, char **av, void *priv __unused) { AddBan(av[2]); diff --git a/varnish-cache/bin/varnishd/cache_expire.c b/varnish-cache/bin/varnishd/cache_expire.c index 8141682c..6a8ac73f 100644 --- a/varnish-cache/bin/varnishd/cache_expire.c +++ b/varnish-cache/bin/varnishd/cache_expire.c @@ -43,7 +43,7 @@ EXP_TTLchange(struct object *o) */ static void * -exp_hangman(void *arg) +exp_hangman(void *arg __unused) { struct object *o; time_t t; @@ -84,7 +84,7 @@ exp_hangman(void *arg) */ static void * -exp_prefetch(void *arg) +exp_prefetch(void *arg __unused) { struct object *o; time_t t; @@ -116,14 +116,12 @@ exp_prefetch(void *arg) } assert(sp.handling == VCL_RET_DISCARD); } - - return ("FOOBAR"); } /*--------------------------------------------------------------------*/ static int -object_cmp(void *priv, void *a, void *b) +object_cmp(void *priv __unused, void *a, void *b) { struct object *aa, *bb; @@ -133,7 +131,7 @@ object_cmp(void *priv, void *a, void *b) } static void -object_update(void *priv, void *p, unsigned u) +object_update(void *priv __unused, void *p, unsigned u) { struct object *o = p; diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index dd230eee..e3364d66 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -30,7 +30,7 @@ /*--------------------------------------------------------------------*/ static int -fetch_straight(struct worker *w, struct sess *sp, int fd, struct http *hp, char *b) +fetch_straight(struct sess *sp, int fd, struct http *hp, char *b) { int i; char *e; @@ -70,7 +70,7 @@ fetch_straight(struct worker *w, struct sess *sp, int fd, struct http *hp, char /* XXX: Cleanup. It must be possible somehow :-( */ static int -fetch_chunked(struct worker *w, struct sess *sp, int fd, struct http *hp) +fetch_chunked(struct sess *sp, int fd, struct http *hp) { int i; char *b, *q, *e; @@ -180,7 +180,7 @@ fetch_chunked(struct worker *w, struct sess *sp, int fd, struct http *hp) #include static int -fetch_eof(struct worker *w, struct sess *sp, int fd, struct http *hp) +fetch_eof(struct sess *sp, int fd, struct http *hp) { int i; char *b, *e; @@ -273,11 +273,11 @@ FetchSession(struct worker *w, struct sess *sp) http_BuildSbuf(sp->fd, Build_Reply, w->sb, hp); if (body) { if (http_GetHdr(hp, "Content-Length", &b)) - cls = fetch_straight(w, sp, vc->fd, hp, b); + cls = fetch_straight(sp, vc->fd, hp, b); else if (http_HdrIs(hp, "Transfer-Encoding", "chunked")) - cls = fetch_chunked(w, sp, vc->fd, hp); + cls = fetch_chunked(sp, vc->fd, hp); else - cls = fetch_eof(w, sp, vc->fd, hp); + cls = fetch_eof(sp, vc->fd, hp); sbuf_printf(w->sb, "Content-Length: %u\r\n", sp->obj->len); } else cls = 0; diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index 825d413c..09478a77 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -308,7 +308,7 @@ http_header_complete(struct http *hp) #include static void -http_read_f(int fd, short event, void *arg) +http_read_f(int fd, short event __unused, void *arg) { struct http *hp = arg; unsigned l; diff --git a/varnish-cache/bin/varnishd/cache_main.c b/varnish-cache/bin/varnishd/cache_main.c index 1a05e0f9..bd73c86e 100644 --- a/varnish-cache/bin/varnishd/cache_main.c +++ b/varnish-cache/bin/varnishd/cache_main.c @@ -21,6 +21,7 @@ static struct event ev_keepalive; struct stevedore *stevedore; pthread_mutex_t sessmtx; +struct varnish_stats *VSL_stats; /*--------------------------------------------------------------------*/ diff --git a/varnish-cache/bin/varnishd/cache_pass.c b/varnish-cache/bin/varnishd/cache_pass.c index 7ac2f669..09916a71 100644 --- a/varnish-cache/bin/varnishd/cache_pass.c +++ b/varnish-cache/bin/varnishd/cache_pass.c @@ -21,7 +21,7 @@ /*--------------------------------------------------------------------*/ static int -pass_straight(struct worker *w, struct sess *sp, int fd, struct http *hp, char *bi) +pass_straight(struct sess *sp, int fd, struct http *hp, char *bi) { int i; char *b, *e; @@ -63,7 +63,7 @@ pass_straight(struct worker *w, struct sess *sp, int fd, struct http *hp, char * /*--------------------------------------------------------------------*/ static int -pass_chunked(struct worker *w, struct sess *sp, int fd, struct http *hp) +pass_chunked(struct sess *sp, int fd, struct http *hp) { int i, j; char *b, *q, *e; @@ -175,11 +175,11 @@ PassSession(struct worker *w, struct sess *sp) vca_write(sp, sbuf_data(w->sb), sbuf_len(w->sb)); if (http_GetHdr(hp, "Content-Length", &b)) - cls = pass_straight(w, sp, vc->fd, hp, b); + cls = pass_straight(sp, vc->fd, hp, b); else if (http_HdrIs(hp, "Connection", "close")) - cls = pass_straight(w, sp, vc->fd, hp, NULL); + cls = pass_straight(sp, vc->fd, hp, NULL); else if (http_HdrIs(hp, "Transfer-Encoding", "chunked")) - cls = pass_chunked(w, sp, vc->fd, hp); + cls = pass_chunked(sp, vc->fd, hp); else { INCOMPL(); cls = 1; diff --git a/varnish-cache/bin/varnishd/cache_pipe.c b/varnish-cache/bin/varnishd/cache_pipe.c index 6e58e81a..d0b71b44 100644 --- a/varnish-cache/bin/varnishd/cache_pipe.c +++ b/varnish-cache/bin/varnishd/cache_pipe.c @@ -19,7 +19,7 @@ struct edir { }; static void -rdf(int fd, short event, void *arg) +rdf(int fd, short event __unused, void *arg) { int i, j; struct edir *ep; diff --git a/varnish-cache/bin/varnishd/cache_shmlog.c b/varnish-cache/bin/varnishd/cache_shmlog.c index bf96093e..a30253c0 100644 --- a/varnish-cache/bin/varnishd/cache_shmlog.c +++ b/varnish-cache/bin/varnishd/cache_shmlog.c @@ -26,7 +26,6 @@ #endif struct varnish_stats *VSL_stats; - static struct shmloghead *loghead; static unsigned char *logstart; static pthread_mutex_t vsl_mutex; @@ -132,8 +131,8 @@ VSL_Init(void) /* XXX check sanity of loghead */ logstart = (unsigned char *)loghead + loghead->start; - VSL_stats = &loghead->stats; AZ(pthread_mutex_init(&vsl_mutex, NULL)); + VSL_stats = &loghead->stats; } /*--------------------------------------------------------------------*/ diff --git a/varnish-cache/bin/varnishd/cache_shmlog.h b/varnish-cache/bin/varnishd/cache_shmlog.h new file mode 100644 index 00000000..f0cb1972 --- /dev/null +++ b/varnish-cache/bin/varnishd/cache_shmlog.h @@ -0,0 +1,6 @@ +/* + * $Id$ + */ + +void VSL_MgtInit(const char *fn, unsigned size); +extern struct varnish_stats *VSL_stats; diff --git a/varnish-cache/bin/varnishd/cache_vcl.c b/varnish-cache/bin/varnishd/cache_vcl.c index 43c238e4..c271102a 100644 --- a/varnish-cache/bin/varnishd/cache_vcl.c +++ b/varnish-cache/bin/varnishd/cache_vcl.c @@ -99,7 +99,7 @@ CVCL_Load(const char *fn, const char *name) } void -cli_func_config_list(struct cli *cli, char **av, void *priv) +cli_func_config_list(struct cli *cli, char **av __unused, void *priv __unused) { struct vcls *vcl; @@ -123,7 +123,7 @@ find_vcls(const char *name) } void -cli_func_config_load(struct cli *cli, char **av, void *priv) +cli_func_config_load(struct cli *cli, char **av, void *priv __unused) { struct vcls *vcl; @@ -166,13 +166,13 @@ cli_func_config_load(struct cli *cli, char **av, void *priv) } void -cli_func_config_unload(struct cli *cli, char **av, void *priv) +cli_func_config_unload(struct cli *cli, char **av __unused, void *priv __unused) { cli_result(cli, CLIS_UNIMPL); } void -cli_func_config_use(struct cli *cli, char **av, void *priv) +cli_func_config_use(struct cli *cli, char **av, void *priv __unused) { struct vcls *vcl; diff --git a/varnish-cache/bin/varnishd/cli_event.c b/varnish-cache/bin/varnishd/cli_event.c index 167e6aa3..53e0cc5c 100644 --- a/varnish-cache/bin/varnishd/cli_event.c +++ b/varnish-cache/bin/varnishd/cli_event.c @@ -110,7 +110,7 @@ rdcb(struct bufferevent *bev, void *arg) } static void -wrcb(struct bufferevent *bev, void *arg) +wrcb(struct bufferevent *bev __unused, void *arg) { struct cli *cli = arg; diff --git a/varnish-cache/bin/varnishd/mgt.h b/varnish-cache/bin/varnishd/mgt.h index 37fe78a0..ab94bfcd 100644 --- a/varnish-cache/bin/varnishd/mgt.h +++ b/varnish-cache/bin/varnishd/mgt.h @@ -24,5 +24,4 @@ extern struct stevedore smf_stevedore; extern struct hash_slinger hsl_slinger; extern struct hash_slinger hcl_slinger; -void VSL_MgtInit(const char *fn, unsigned size); -extern struct varnish_stats *VSL_stats; +#include "cache_shmlog.h" diff --git a/varnish-cache/bin/varnishd/mgt_child.c b/varnish-cache/bin/varnishd/mgt_child.c index 80a49bab..f4906736 100644 --- a/varnish-cache/bin/varnishd/mgt_child.c +++ b/varnish-cache/bin/varnishd/mgt_child.c @@ -58,7 +58,7 @@ static TAILQ_HEAD(,creq) creqhead = TAILQ_HEAD_INITIALIZER(creqhead); */ static void -std_rdcb(struct bufferevent *bev, void *arg) +std_rdcb(struct bufferevent *bev, void *arg __unused) { const char *p; @@ -132,7 +132,7 @@ mgt_child_request(mgt_ccb_f *func, void *priv, char **argv, const char *fmt, ... } static void -cli_rdcb(struct bufferevent *bev, void *arg) +cli_rdcb(struct bufferevent *bev, void *arg __unused) { const char *p; char **av; @@ -174,14 +174,14 @@ cli_excb(struct bufferevent *bev, short what, void *arg) /*--------------------------------------------------------------------*/ static void -child_pingpong_ccb(unsigned u, const char *r, void *priv) +child_pingpong_ccb(unsigned u __unused, const char *r __unused, void *priv __unused) { /* XXX: reset keepalive timer */ } static void -child_pingpong(int a, short b, void *c) +child_pingpong(int a __unused, short b __unused, void *c __unused) { time_t t; struct timeval tv; diff --git a/varnish-cache/bin/varnishd/tcp.c b/varnish-cache/bin/varnishd/tcp.c index 70f3c1a0..becf59d2 100644 --- a/varnish-cache/bin/varnishd/tcp.c +++ b/varnish-cache/bin/varnishd/tcp.c @@ -11,6 +11,7 @@ #include #include "heritage.h" +#include "mgt.h" #include "libvarnish.h" static void diff --git a/varnish-cache/bin/varnishd/varnishd.c b/varnish-cache/bin/varnishd/varnishd.c index 751c86d7..60e57104 100644 --- a/varnish-cache/bin/varnishd/varnishd.c +++ b/varnish-cache/bin/varnishd/varnishd.c @@ -50,7 +50,7 @@ cli_passthrough_cb(unsigned u, const char *r, void *priv) } static void -m_cli_func_passthrough(struct cli *cli, char **av, void *priv) +m_cli_func_passthrough(struct cli *cli, char **av, void *priv __unused) { (void)av; -- 2.39.5