From 7f08785d4eb8fa6f10c42bfb5369f316d136a553 Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 28 Jan 2009 10:46:54 +0000 Subject: [PATCH] silence a couple of Flexelint complaints. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3548 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/lib/libvarnish/tcp.c | 4 ++-- varnish-cache/lib/libvarnish/vss.c | 2 +- varnish-cache/lib/libvcl/vcc_acl.c | 37 ++++++++++++++++++++++-------- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/varnish-cache/lib/libvarnish/tcp.c b/varnish-cache/lib/libvarnish/tcp.c index 35d63df1..489a2258 100644 --- a/varnish-cache/lib/libvarnish/tcp.c +++ b/varnish-cache/lib/libvarnish/tcp.c @@ -216,8 +216,8 @@ void TCP_set_read_timeout(int s, double seconds) { struct timeval timeout; - timeout.tv_sec = floor(seconds); - timeout.tv_usec = 1e6 * (seconds - timeout.tv_sec); + timeout.tv_sec = (int)floor(seconds); + timeout.tv_usec = (int)(1e6 * (seconds - timeout.tv_sec)); #ifdef SO_RCVTIMEO_WORKS AZ(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout)); #endif diff --git a/varnish-cache/lib/libvarnish/vss.c b/varnish-cache/lib/libvarnish/vss.c index ac46d70c..a6c870f0 100644 --- a/varnish-cache/lib/libvarnish/vss.c +++ b/varnish-cache/lib/libvarnish/vss.c @@ -155,7 +155,7 @@ VSS_resolve(const char *addr, const char *port, struct vss_addr ***vap) XXXAN(va); *vap = va; for (res = res0, i = 0; res != NULL; res = res->ai_next, ++i) { - va[i] = calloc(1, sizeof(*va[i])); + va[i] = calloc(1, sizeof(**va)); XXXAN(va[i]); va[i]->va_family = res->ai_family; va[i]->va_socktype = res->ai_socktype; diff --git a/varnish-cache/lib/libvcl/vcc_acl.c b/varnish-cache/lib/libvcl/vcc_acl.c index f3155e20..ea7cc6d4 100644 --- a/varnish-cache/lib/libvcl/vcc_acl.c +++ b/varnish-cache/lib/libvcl/vcc_acl.c @@ -321,20 +321,20 @@ vcc_acl_entry(struct tokenlist *tl) * Emit a function to match the ACL we have collected */ +/* + * XXX: this is semi-silly. We try really hard to not depend in the + * XXX: systems include files while compiling VCL, but we need to know + * XXX: the size of the sa_familiy member. + * XXX: FlexeLint complains about these antics, so isolate it in a + * XXX: separate function. + */ + +/*lint -save -e506 -e774 -e550 */ static void -vcc_acl_emit(const struct tokenlist *tl, const char *acln, int anon) +c_is_a_silly_language(const struct tokenlist *tl) { - struct acl_e *ae; - int depth, l, m, i; - unsigned at[VRT_ACL_MAXADDR + 1]; - const char *oc; struct sockaddr sa; - Fh(tl, 0, "\nstatic int\n"); - Fh(tl, 0, "match_acl_%s_%s(const struct sess *sp, const void *p)\n", - anon ? "anon" : "named", acln); - Fh(tl, 0, "{\n"); - Fh(tl, 0, "\tconst unsigned char *a;\n"); assert(sizeof (unsigned char) == 1); assert(sizeof (unsigned short) == 2); assert(sizeof (unsigned int) == 4); @@ -346,6 +346,23 @@ vcc_acl_emit(const struct tokenlist *tl, const char *acln, int anon) Fh(tl, 0, "\tunsigned int fam;\n"); else assert(0 == __LINE__); +} +/*lint -restore */ + +static void +vcc_acl_emit(const struct tokenlist *tl, const char *acln, int anon) +{ + struct acl_e *ae; + int depth, l, m, i; + unsigned at[VRT_ACL_MAXADDR + 1]; + const char *oc; + + Fh(tl, 0, "\nstatic int\n"); + Fh(tl, 0, "match_acl_%s_%s(const struct sess *sp, const void *p)\n", + anon ? "anon" : "named", acln); + Fh(tl, 0, "{\n"); + Fh(tl, 0, "\tconst unsigned char *a;\n"); + c_is_a_silly_language(tl); Fh(tl, 0, "\n"); Fh(tl, 0, "\ta = p;\n"); -- 2.39.5