From b4b2f149d27bfb695cadc6077d2ee205b9d80e97 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 18 Sep 2006 07:36:33 +0000 Subject: [PATCH] Make flexelint happier git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1061 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 4 ---- varnish-cache/bin/varnishd/cache_acceptor_kqueue.c | 2 +- varnish-cache/bin/varnishd/cache_center.c | 1 - varnish-cache/bin/varnishd/cache_http.c | 5 +---- varnish-cache/bin/varnishd/cache_pool.c | 2 +- varnish-cache/bin/varnishd/cache_session.c | 2 +- varnish-cache/bin/varnishd/cache_vrt_acl.c | 4 ++-- varnish-cache/bin/varnishd/flint.lnt | 3 +++ varnish-cache/bin/varnishd/mgt_child.c | 3 ++- varnish-cache/bin/varnishd/mgt_param.c | 5 ----- varnish-cache/bin/varnishd/shmlog.c | 6 ++---- varnish-cache/bin/varnishd/varnishd.c | 6 +++--- 12 files changed, 16 insertions(+), 27 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 65d00b50..c9573951 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -124,8 +124,6 @@ struct worker { }; struct workreq { - unsigned magic; -#define WORKREQ_MAGIC 0x5ccb4eb2 TAILQ_ENTRY(workreq) list; struct sess *sess; }; @@ -342,7 +340,6 @@ void http_SetResp(struct worker *w, int fd, struct http *to, const char *proto, void http_FilterHeader(struct worker *w, int fd, struct http *to, struct http *fm, unsigned how); void http_PrintfHeader(struct worker *w, int fd, struct http *to, const char *fmt, ...); void http_SetHeader(struct worker *w, int fd, struct http *to, const char *hdr); -int http_IsHdr(struct http_hdr *hh, char *hdr); void http_Setup(struct http *ht, void *space, unsigned len); int http_GetHdr(struct http *hp, const char *hdr, char **ptr); int http_GetHdrField(struct http *hp, const char *hdr, const char *field, char **ptr); @@ -396,7 +393,6 @@ void VSL(enum shmlogtag tag, unsigned id, const char *fmt, ...); void WSLR(struct worker *w, enum shmlogtag tag, unsigned id, const char *b, const char *e); void WSL(struct worker *w, enum shmlogtag tag, unsigned id, const char *fmt, ...); void WSL_Flush(struct worker *w); -#define HERE() VSL(SLT_Debug, 0, "HERE: %s(%d)", __func__, __LINE__) #define INCOMPL() do { \ VSL(SLT_Debug, 0, "INCOMPLETE AT: %s(%d)", __func__, __LINE__); \ fprintf(stderr,"INCOMPLETE AT: %s(%d)\n", (const char *)__func__, __LINE__); \ diff --git a/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c b/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c index 0eb36af0..79567178 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c +++ b/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c @@ -33,7 +33,7 @@ static struct kevent ki[NKEV]; static unsigned nki; static void -vca_kq_sess(struct sess *sp, int arm) +vca_kq_sess(struct sess *sp, short arm) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); diff --git a/varnish-cache/bin/varnishd/cache_center.c b/varnish-cache/bin/varnishd/cache_center.c index d19e879e..2b8bd2ed 100644 --- a/varnish-cache/bin/varnishd/cache_center.c +++ b/varnish-cache/bin/varnishd/cache_center.c @@ -35,7 +35,6 @@ DOT start -> RECV #include #include "shmlog.h" -#include "heritage.h" #include "vcl.h" #include "cache.h" diff --git a/varnish-cache/bin/varnishd/cache_http.c b/varnish-cache/bin/varnishd/cache_http.c index 54cdf7b0..6cd83d1b 100644 --- a/varnish-cache/bin/varnishd/cache_http.c +++ b/varnish-cache/bin/varnishd/cache_http.c @@ -58,9 +58,6 @@ T(struct http *hp, enum httptag t) return (logmtx[hp->logtag][t]); } -#define VSLH(ax, bx, cx, dx) \ - VSLR(T((cx), (ax)), (bx), (cx)->hd[(dx)].b, (cx)->hd[(dx)].e); - #define WSLH(wx, ax, bx, cx, dx) \ WSLR(wx, T((cx), (ax)), (bx), (cx)->hd[(dx)].b, (cx)->hd[(dx)].e); @@ -85,7 +82,7 @@ http_Setup(struct http *hp, void *space, unsigned len) /*--------------------------------------------------------------------*/ -int +static int http_IsHdr(struct http_hdr *hh, char *hdr) { unsigned l; diff --git a/varnish-cache/bin/varnishd/cache_pool.c b/varnish-cache/bin/varnishd/cache_pool.c index ef9849f6..44f49760 100644 --- a/varnish-cache/bin/varnishd/cache_pool.c +++ b/varnish-cache/bin/varnishd/cache_pool.c @@ -240,7 +240,7 @@ WRK_QueueSession(struct sess *sp) struct worker *w; pthread_t tp; struct wq *qp; - static unsigned nq; + static unsigned nq = 0; unsigned onq; onq = nq + 1; diff --git a/varnish-cache/bin/varnishd/cache_session.c b/varnish-cache/bin/varnishd/cache_session.c index 2dc01d9e..1d69bdaf 100644 --- a/varnish-cache/bin/varnishd/cache_session.c +++ b/varnish-cache/bin/varnishd/cache_session.c @@ -76,7 +76,7 @@ static struct srcaddrhead { MTX mtx; } *srchash; -unsigned nsrchash; +static unsigned nsrchash; static MTX stat_mtx; /*-------------------------------------------------------------------- diff --git a/varnish-cache/bin/varnishd/cache_vrt_acl.c b/varnish-cache/bin/varnishd/cache_vrt_acl.c index 51bd3c86..bc7ce8d7 100644 --- a/varnish-cache/bin/varnishd/cache_vrt_acl.c +++ b/varnish-cache/bin/varnishd/cache_vrt_acl.c @@ -21,9 +21,9 @@ #include -static unsigned ipv4mask[] = { +static uint32_t ipv4mask[] = { [0] = 0xffffffff, -#define M(n) [n] = (0xffffffff << (32 - n)) +#define M(n) [n] = (uint32_t)((uint64_t)0xffffffff << (32 - n)) M( 1), M( 2), M( 3), M( 4), M( 5), M( 6), M( 7), M( 8), M( 9), M(10), M(11), M(12), M(13), M(14), M(15), M(16), M(17), M(18), M(19), M(20), M(21), M(22), M(23), M(24), M(25), M(26), M(27), M(28), M(29), M(30), diff --git a/varnish-cache/bin/varnishd/flint.lnt b/varnish-cache/bin/varnishd/flint.lnt index 6c5f2b8a..9d9ab0a4 100644 --- a/varnish-cache/bin/varnishd/flint.lnt +++ b/varnish-cache/bin/varnishd/flint.lnt @@ -1,6 +1,7 @@ -passes=3 +libh mgt_event.h ++libh ../../config.h -header(../../config.h) @@ -20,7 +21,9 @@ -e786 // String concatenation within initializer -emacro(740, TAILQ_PREV) // Unusual pointer cast (incompatible indirect types) +-emacro(740, TAILQ_LAST) // Unusual pointer cast (incompatible indirect types) -emacro((826), TAILQ_PREV) // Suspicious pointer-to-pointer conversion (area too small) +-emacro((826), TAILQ_LAST) // Suspicious pointer-to-pointer conversion (area too small) -esym(534, printf) // Ignoring return value of function diff --git a/varnish-cache/bin/varnishd/mgt_child.c b/varnish-cache/bin/varnishd/mgt_child.c index 8ff3babf..f9e9b24b 100644 --- a/varnish-cache/bin/varnishd/mgt_child.c +++ b/varnish-cache/bin/varnishd/mgt_child.c @@ -97,6 +97,7 @@ static void start_child(void) { int i; + unsigned u; char *p; struct ev *e; @@ -170,7 +171,7 @@ start_child(void) AZ(close(heritage.fds[2])); heritage.fds[2] = -1; child_pid = i; - if (mgt_push_vcls_and_start(&i, &p)) { + if (mgt_push_vcls_and_start(&u, &p)) { fprintf(stderr, "Pushing vcls failed:\n%s\n", p); free(p); /* Pick up any stuff lingering on stdout/stderr */ diff --git a/varnish-cache/bin/varnishd/mgt_param.c b/varnish-cache/bin/varnishd/mgt_param.c index 219b353c..c7f20b90 100644 --- a/varnish-cache/bin/varnishd/mgt_param.c +++ b/varnish-cache/bin/varnishd/mgt_param.c @@ -14,7 +14,6 @@ #include "mgt.h" #include "mgt_cli.h" -#include "vsb.h" #include "heritage.h" struct parspec; @@ -308,10 +307,6 @@ tweak_srcaddr_ttl(struct cli *cli, struct parspec *par, const char *arg) #define DELAYED_EFFECT \ "\nNB: This parameter will take some time to take effect.\n" -#define SHOULD_RESTART \ - "\nNB: This parameter will not take full effect until the " \ - "child process has been restarted.\n" - #define MUST_RESTART \ "\nNB: This parameter will not take any effect until the " \ "child process has been restarted.\n" diff --git a/varnish-cache/bin/varnishd/shmlog.c b/varnish-cache/bin/varnishd/shmlog.c index 8a6ad565..1e6cce65 100644 --- a/varnish-cache/bin/varnishd/shmlog.c +++ b/varnish-cache/bin/varnishd/shmlog.c @@ -107,8 +107,7 @@ VSL(enum shmlogtag tag, unsigned id, const char *fmt, ...) va_start(ap, fmt); - p = strchr(fmt, '%'); - if (p == NULL) { + if (strchr(fmt, '%') == NULL) { VSLR(tag, id, fmt, NULL); return; } @@ -221,8 +220,7 @@ WSL(struct worker *w, enum shmlogtag tag, unsigned id, const char *fmt, ...) va_start(ap, fmt); - p = strchr(fmt, '%'); - if (p == NULL) { + if (strchr(fmt, '%') == NULL) { WSLR(w, tag, id, fmt, NULL); return; } diff --git a/varnish-cache/bin/varnishd/varnishd.c b/varnish-cache/bin/varnishd/varnishd.c index 74f8676c..77652ae5 100644 --- a/varnish-cache/bin/varnishd/varnishd.c +++ b/varnish-cache/bin/varnishd/varnishd.c @@ -347,9 +347,9 @@ main(int argc, char *argv[]) setbuf(stderr, NULL); memset(cli, 0, sizeof cli); - cli->sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); - XXXAN(cli->sb); - cli->result = CLIS_OK; + cli[0].sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND); + XXXAN(cli[0].sb); + cli[0].result = CLIS_OK; heritage.socket = -1; memset(¶m, 0, sizeof param); -- 2.39.5