Commit db2508e5 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

More Flexelint nitpickery



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3004 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent fa8a1e71
......@@ -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, ...)
{
......
......@@ -10,6 +10,8 @@
-efile(766, ../../config.h)
-emacro(413, offsetof) // likely null pointer
-emacro(702, WEXITSTATUS) // signed shift right
// -header(../../config.h)
......@@ -38,6 +40,10 @@
-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
......
......@@ -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)
{
......
......@@ -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)
{
......
......@@ -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,
......
......@@ -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);
......
......@@ -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");
}
}
/*--------------------------------------------------------------------
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment