]> err.no Git - varnish/commitdiff
More Flexelint nitpickery
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 23 Jul 2008 17:37:44 +0000 (17:37 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 23 Jul 2008 17:37:44 +0000 (17:37 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3004 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_vrt.c
varnish-cache/bin/varnishd/flint.lnt
varnish-cache/bin/varnishd/mgt_child.c
varnish-cache/lib/libvarnish/cli_common.c
varnish-cache/lib/libvcl/vcc_acl.c
varnish-cache/lib/libvcl/vcc_compile.h
varnish-cache/lib/libvcl/vcc_token.c
varnish-cache/lib/libvcl/vcc_xref.c

index 6c08a1ad573100e1af96e0c5637ecb75175a3498..2bc01609f0b62fdccc798dc303b6fbab6065cf7c 100644 (file)
@@ -118,6 +118,7 @@ VRT_GetHdr(const struct sess *sp, enum gethdr_e where, const char *n)
 
 /*--------------------------------------------------------------------*/
 
+/*lint -e{818} ap,hp could be const */
 static char *
 vrt_assemble_string(struct http *hp, const char *h, const char *p, va_list ap)
 {
@@ -419,6 +420,7 @@ VRT_l_req_backend(struct sess *sp, struct director *be)
        sp->director = be;
 }
 
+/*lint -e{818} sp could be const */
 struct director *
 VRT_r_req_backend(struct sess *sp)
 {
@@ -450,6 +452,7 @@ VRT_l_req_grace(struct sess *sp, double a)
        sp->grace = a;
 }
 
+/*lint -e{818} sp could be const */
 double
 VRT_r_req_grace(struct sess *sp)
 {
@@ -626,6 +629,7 @@ VRT_Rollback(struct sess *sp)
        
 /*--------------------------------------------------------------------*/
 
+/*lint -e{818} sp could be const */
 void
 VRT_panic(struct sess *sp, const char *str, ...)
 {
index 3b9d95e54a40336ce5b67d891ebc4f096da1aa4a..480c7a9d1e78fd5c66a2deb6862a05f0aa164374 100644 (file)
@@ -10,6 +10,8 @@
 -efile(766, ../../config.h)
 -emacro(413, offsetof) // likely null pointer
 
+-emacro(702, WEXITSTATUS)      // signed shift right 
+
 
 // -header(../../config.h)
 
 -emacro((826), VTAILQ_LAST) // Suspicious pointer-to-pointer conversion (area too small)
 -emacro(506, VTAILQ_FOREACH_SAFE) // constant value boolean
 
+-esym(765, vcc_ProcAction) // could be made static
+-esym(759, vcc_ProcAction) // could be moved to module
+-esym(714, vcc_ProcAction) // not ref.
+
 -esym(534, sprintf)    // Ignoring return value of function
 -esym(534, asprintf)   // Ignoring return value of function
 -esym(534, printf)     // Ignoring return value of function
index fede7fda552ba18abf5a57f8dd17a8054fccefab..849db1fa3003f88cf757710b6db6d02ec891b0de 100644 (file)
@@ -544,6 +544,7 @@ mgt_run(int dflag, const char *T_arg)
 
 /*--------------------------------------------------------------------*/
 
+/*lint -e{818} priv could be const */
 void
 mcf_server_startstop(struct cli *cli, const char * const *av, void *priv)
 {
index def3da893a19b8907d12b463ff54adc4b05de01b..a4fc9f942a9d73398097f224c7a457bb12628808 100644 (file)
@@ -68,6 +68,7 @@ cli_out(struct cli *cli, const char *fmt, ...)
        va_end(ap);
 }
 
+/*lint -e{818} cli could be const */
 void
 cli_quote(struct cli *cli, const char *s)
 {
index 85f1f9bab503faeeba707e089ae74de40a2db690..20d2acfd89204fe39bad464a2416de9b78967f2c 100644 (file)
@@ -155,7 +155,7 @@ vcc_acl_emit_entry(struct tokenlist *tl, const struct acl_e *ae, int l, const un
        AN(ae2);
        *ae2 = *ae;
 
-       ae2->data[0] = fam;
+       ae2->data[0] = fam & 0xff;
        ae2->mask += 8; /* family matching */
 
        memcpy(ae2->data + 1, u, l);
@@ -171,7 +171,7 @@ vcc_acl_try_getaddrinfo(struct tokenlist *tl, struct acl_e *ae)
        struct sockaddr_in *sin4;
        struct sockaddr_in6 *sin6;
        unsigned char *u, i4, i6;
-       int error, l;
+       int error;
 
        memset(&hint, 0, sizeof hint);
        hint.ai_family = PF_UNSPEC;
@@ -204,21 +204,23 @@ vcc_acl_try_getaddrinfo(struct tokenlist *tl, struct acl_e *ae)
                switch(res->ai_family) {
                case PF_INET:
                        sin4 = (void*)res->ai_addr;
+                       assert(sizeof(sin4->sin_family) == 1);
+                       assert(sizeof(sin4->sin_addr) == 4);
                        u = (void*)&sin4->sin_addr;
-                       l = 4;
                        if (ae->t_mask == NULL)
                                ae->mask = 32;
                        i4++;
-                       vcc_acl_emit_entry(tl, ae, l, u, res->ai_family);
+                       vcc_acl_emit_entry(tl, ae, 4, u, res->ai_family);
                        break;
                case PF_INET6:
                        sin6 = (void*)res->ai_addr;
+                       assert(sizeof(sin4->sin_family) == 1);
+                       assert(sizeof(sin4->sin_addr) == 16);
                        u = (void*)&sin6->sin6_addr;
-                       l = 16;
                        if (ae->t_mask == NULL)
                                ae->mask = 128;
                        i6++;
-                       vcc_acl_emit_entry(tl, ae, l, u, res->ai_family);
+                       vcc_acl_emit_entry(tl, ae, 16, u, res->ai_family);
                        break;
                default:
                        vsb_printf(tl->sb,
index 696bea062b6c0bbc492fff0bd3b8379440b6bf58..4b80f0cd928e5b70d85a4f5cef7109b40d93c302 100644 (file)
@@ -208,7 +208,6 @@ void vcc_ErrWhere(struct tokenlist *tl, const struct token *t);
 void vcc__Expect(struct tokenlist *tl, unsigned tok, int line);
 int vcc_Teq(const struct token *t1, const struct token *t2);
 int vcc_IdIs(const struct token *t, const char *p);
-int vcc_isCid(const struct token *t);
 void vcc_ExpectCid(struct tokenlist *tl);
 void vcc_Lexer(struct tokenlist *tl, struct source *sp);
 void vcc_NextToken(struct tokenlist *tl);
index c6f4000e78932333f37ad2a04c842c3c1628ba2e..5e20e965846aa99c9a30c485afc31bf1e1b4a868 100644 (file)
@@ -191,7 +191,7 @@ vcc_IdIs(const struct token *t, const char *p)
  * Check that we have a C-identifier
  */
 
-int
+static int
 vcc_isCid(const struct token *t)
 {
        const char *q;
@@ -266,7 +266,7 @@ vcc_decstr(struct tokenlist *tl)
                        vcc_ErrWhere(tl, tl->t);
                        return(1);
                }
-               u = vcc_xdig(p[1]) * 16 + vcc_xdig(p[2]);
+               u = (vcc_xdig(p[1]) * 16 + vcc_xdig(p[2])) & 0xff;
                if (!isgraph(u)) {
                        vcc_AddToken(tl, CSTR, p, p + 3);
                        vsb_printf(tl->sb,
@@ -301,12 +301,6 @@ vcc_AddToken(struct tokenlist *tl, unsigned tok, const char *b, const char *e)
        else
                VTAILQ_INSERT_TAIL(&tl->tokens, t, list);
        tl->t = t;
-       if (0) {
-               fprintf(stderr, "[%s %.*s] ",
-                   vcl_tnames[tok], PF(t));
-               if (tok == EOI)
-                       fprintf(stderr, "\n");
-       }
 }
 
 /*--------------------------------------------------------------------
index 21c324a304d1d29c98dfefec664abef560885d38..8ce7e87552dedfcc7994f87c8b716b2a4ace3344 100644 (file)
@@ -242,7 +242,7 @@ void
 vcc_ProcAction(struct proc *p, unsigned returns, struct token *t)
 {
 
-       p->returns |= (1 << returns);
+       p->returns |= (1U << returns);
        /* Record the first instance of this return */
        if (p->return_tok[returns] == NULL)
                p->return_tok[returns] = t;
@@ -266,16 +266,15 @@ vcc_CheckActionRecurse(struct tokenlist *tl, struct proc *p, unsigned returns)
        }
        u = p->returns & ~returns;
        if (u) {
-/*lint -e525 */
+/*lint -save -e525 -e539 */
 #define VCL_RET_MAC(a, b, c, d) \
                if (u & VCL_RET_##b) { \
                        vsb_printf(tl->sb, "Invalid return \"%s\"\n", #a); \
                        vcc_ErrWhere(tl, p->return_tok[d]); \
                }
-/*lint -e525 */
 #include "vcl_returns.h"
-/*lint +e525 */
 #undef VCL_RET_MAC
+/*lint -restore */
                vsb_printf(tl->sb, "\n...in function \"%.*s\"\n", PF(p->name));
                vcc_ErrWhere(tl, p->name);
                return (1);
@@ -314,11 +313,12 @@ vcc_CheckAction(struct tokenlist *tl)
                        if (m->returns & c) \
                                vsb_printf(tl->sb, " \"%s\"", #a);
 #define VCL_RET_MAC_E(a, b, c, d) VCL_RET_MAC(a, b, c, d)
-/*lint -e525 */
+/*lint -save -e525 -e539 */
 #include "vcl_returns.h"
 /*lint +e525 */
 #undef VCL_RET_MAC
 #undef VCL_RET_MAC_E
+/*lint -restore */
                        vsb_printf(tl->sb, "\n");
                        return (1);
                }