r4908 - in trunk/varnish-cache/bin: . varnishd varnishtest
phk at varnish-cache.org
phk at varnish-cache.org
Sat Jun 5 17:14:43 CEST 2010
Author: phk
Date: 2010-06-05 17:14:43 +0200 (Sat, 05 Jun 2010)
New Revision: 4908
Modified:
trunk/varnish-cache/bin/flint.lnt
trunk/varnish-cache/bin/varnishd/flint.lnt
trunk/varnish-cache/bin/varnishtest/flint.lnt
trunk/varnish-cache/bin/varnishtest/vtc.c
trunk/varnish-cache/bin/varnishtest/vtc.h
trunk/varnish-cache/bin/varnishtest/vtc_http.c
trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
Log:
More flexelinting
Modified: trunk/varnish-cache/bin/flint.lnt
===================================================================
--- trunk/varnish-cache/bin/flint.lnt 2010-06-05 14:53:26 UTC (rev 4907)
+++ trunk/varnish-cache/bin/flint.lnt 2010-06-05 15:14:43 UTC (rev 4908)
@@ -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
Modified: trunk/varnish-cache/bin/varnishd/flint.lnt
===================================================================
--- trunk/varnish-cache/bin/varnishd/flint.lnt 2010-06-05 14:53:26 UTC (rev 4907)
+++ trunk/varnish-cache/bin/varnishd/flint.lnt 2010-06-05 15:14:43 UTC (rev 4908)
@@ -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))
Modified: trunk/varnish-cache/bin/varnishtest/flint.lnt
===================================================================
--- trunk/varnish-cache/bin/varnishtest/flint.lnt 2010-06-05 14:53:26 UTC (rev 4907)
+++ trunk/varnish-cache/bin/varnishtest/flint.lnt 2010-06-05 15:14:43 UTC (rev 4908)
@@ -4,7 +4,13 @@
-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) ...
Modified: trunk/varnish-cache/bin/varnishtest/vtc.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc.c 2010-06-05 14:53:26 UTC (rev 4907)
+++ trunk/varnish-cache/bin/varnishtest/vtc.c 2010-06-05 15:14:43 UTC (rev 4908)
@@ -133,14 +133,16 @@
}
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(¯o_mtx));
+ l = e - b;
VTAILQ_FOREACH(m, ¯o_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 @@
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 @@
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);
@@ -402,23 +404,6 @@
}
/**********************************************************************
- * 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
*/
Modified: trunk/varnish-cache/bin/varnishtest/vtc.h
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc.h 2010-06-05 14:53:26 UTC (rev 4907)
+++ trunk/varnish-cache/bin/varnishtest/vtc.h 2010-06-05 15:14:43 UTC (rev 4908)
@@ -47,7 +47,6 @@
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;
Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2010-06-05 14:53:26 UTC (rev 4907)
+++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2010-06-05 15:14:43 UTC (rev 4908)
@@ -116,8 +116,8 @@
k = '!';
l = k;
} else {
- b[j] = l++;
- if (l == '~')
+ b[j] = (char)l;
+ if (++l == '~')
l = '!';
}
}
@@ -505,7 +505,7 @@
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;
Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2010-06-05 14:53:26 UTC (rev 4907)
+++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2010-06-05 15:14:43 UTC (rev 4908)
@@ -226,7 +226,7 @@
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 @@
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 @@
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 @@
sp.target = av[0];
sp.val = 0;
+ ref = 0;
for (i = 0; i < 10; i++, (void)usleep(100000)) {
good = -1;
More information about the varnish-commit
mailing list