Commit 6fd5ace7 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

More flexelinting



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4908 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 84717c91
......@@ -97,3 +97,5 @@
+libh(/usr/include/curses.h)
-elib(659) // no tokens after struct def.
-elib(123) // macro def. with arg at, (just warn)
-emacro(702, WEXITSTATUS) // signed shift right
......@@ -95,7 +95,6 @@
-emacro(527, NEEDLESS_RETURN) // unreachable code
-emacro(702, WEXITSTATUS) // signed shift right
-efunc(525, VCC_Return_Name) // Negative indent
-sem(WS_Init, custodial(2))
......
......@@ -4,6 +4,12 @@
-e712 // 14 Info 712 Loss of precision (___) (___ to ___)
-e747 // 16 Info 747 Significant prototype coercion (___) ___ to ___
-e445 // Reuse of for loop variable '___' at '___' could cause chaos
-e850 // for loop index variable '___' whose type category is '___' is modified in body of the for loop that began at '___'
-e443 // for clause irregularity: variable '___' initialized in 1st expression does not match '___' modified in 3rd
-e679 // Suspicious Truncation in arithmetic expression combining with pointer
-e763 // Redundant declaration for symbol '...' previously declared
-e716 // while(1) ...
......
......@@ -133,14 +133,16 @@ macro_def(struct vtclog *vl, const char *instance, const char *name,
}
static char *
macro_get(const char *name)
macro_get(const char *b, const char *e)
{
struct macro *m;
int l;
char *retval = NULL;
AZ(pthread_mutex_lock(&macro_mtx));
l = e - b;
VTAILQ_FOREACH(m, &macro_list, list)
if (!strcmp(name, m->name))
if (!memcmp(b, m->name, l) && m->name[l] == '\0')
break;
if (m != NULL)
retval = strdup(m->val);
......@@ -152,7 +154,8 @@ struct vsb *
macro_expand(struct vtclog *vl, const char *text)
{
struct vsb *vsb;
char *p, *q, *m;
const char *p, *q;
char *m;
vsb = vsb_newauto();
AN(vsb);
......@@ -172,8 +175,7 @@ macro_expand(struct vtclog *vl, const char *text)
assert(p[1] == '{');
assert(q[0] == '}');
p += 2;
*q = '\0';
m = macro_get(p);
m = macro_get(p, q);
if (m == NULL) {
vsb_delete(vsb);
vtc_log(vl, 0, "Macro ${%s} not found", p);
......@@ -401,23 +403,6 @@ cmd_delay(CMD_ARGS)
TIM_sleep(f);
}
/**********************************************************************
* Dump command arguments
*/
void
cmd_dump(CMD_ARGS)
{
(void)cmd;
(void)vl;
if (av == NULL)
return;
printf("cmd_dump(%p)\n", priv);
while (*av)
printf("\t<%s>\n", *av++);
}
/**********************************************************************
* Check random generator
*/
......
......@@ -47,7 +47,6 @@ struct cmds {
void parse_string(char *buf, const struct cmds *cmd, void *priv,
struct vtclog *vl);
cmd_f cmd_dump;
cmd_f cmd_delay;
cmd_f cmd_server;
cmd_f cmd_client;
......
......@@ -116,8 +116,8 @@ synth_body(const char *len)
k = '!';
l = k;
} else {
b[j] = l++;
if (l == '~')
b[j] = (char)l;
if (++l == '~')
l = '!';
}
}
......@@ -505,7 +505,7 @@ cmd_http_txresp(CMD_ARGS)
const char *proto = "HTTP/1.1";
const char *status = "200";
const char *msg = "Ok";
int bodylen;
int bodylen = 0;
char *b, *c;
char *body = NULL;
......
......@@ -226,7 +226,7 @@ varnish_thread(void *priv)
int i;
CAST_OBJ_NOTNULL(v, priv, VARNISH_MAGIC);
TCP_nonblocking(v->fds[0]);
(void)TCP_nonblocking(v->fds[0]);
while (1) {
fds = &fd;
memset(fds, 0, sizeof fds);
......@@ -332,7 +332,6 @@ varnish_launch(struct varnish *v)
AZ(close(v->cli_fd));
v->cli_fd = nfd;
nfd = -1;
vtc_log(v->vl, 3, "CLI connection fd = %d", v->cli_fd);
assert(v->cli_fd >= 0);
......@@ -365,7 +364,7 @@ varnish_launch(struct varnish *v)
if (v->stats != NULL)
VSL_Close(v->vd);
VSL_Arg(v->vd, 'n', v->workdir);
(void)VSL_Arg(v->vd, 'n', v->workdir);
v->stats = VSL_OpenStats(v->vd);
}
......@@ -651,6 +650,7 @@ varnish_expect(const struct varnish *v, char * const *av) {
sp.target = av[0];
sp.val = 0;
ref = 0;
for (i = 0; i < 10; i++, (void)usleep(100000)) {
good = -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