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

Further Flexelint polishing



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4237 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 7d43df3a
......@@ -418,15 +418,12 @@ Symbol_Lookup(struct vsb *vsb, void *ptr)
VTAILQ_FOREACH(s, &symbols, list) {
if (s->a > pp)
continue;
if (s0 != NULL && s->a < s0->a)
continue;
s0 = s;
if (s0 == NULL || s->a < s0->a)
s0 = s;
}
if (s0 == NULL)
return (-1);
vsb_printf(vsb, "%p", ptr);
if (s0 != NULL)
vsb_printf(vsb, ": %s+%jx", s0->n, (uintmax_t)pp - s0->a);
vsb_printf(vsb, "%p: %s+%jx", ptr, s0->n, (uintmax_t)pp - s0->a);
return (0);
}
......@@ -438,40 +435,43 @@ Symbol_hack(const char *a0)
uintptr_t a;
struct symbols *s;
strcpy(buf, "nm -an ");
strcat(buf, a0);
p = NULL;
asprintf(&p, "nm -an %s", a0);
if (p == NULL)
return;
fi = popen(buf, "r");
if (fi != NULL) {
while (fgets(buf, sizeof buf, fi)) {
if (buf[0] == ' ')
continue;
p = NULL;
a = strtoul(buf, &p, 16);
if (p == NULL)
continue;
if (a == 0)
continue;
if (*p++ != ' ')
continue;
p++;
if (*p++ != ' ')
continue;
if (*p <= ' ')
continue;
e = strchr(p, '\0');
AN(e);
while (e > p && isspace(e[-1]))
e--;
*e = '\0';
s = malloc(sizeof *s + strlen(p) + 1);
AN(s);
s->a = a;
s->n = (void*)(s + 1);
strcpy(s->n, p);
VTAILQ_INSERT_TAIL(&symbols, s, list);
}
(void)pclose(fi);
free(p);
if (fi == NULL)
return;
while (fgets(buf, sizeof buf, fi)) {
if (buf[0] == ' ')
continue;
p = NULL;
a = strtoul(buf, &p, 16);
if (p == NULL)
continue;
if (a == 0)
continue;
if (*p++ != ' ')
continue;
p++;
if (*p++ != ' ')
continue;
if (*p <= ' ')
continue;
e = strchr(p, '\0');
AN(e);
while (e > p && isspace(e[-1]))
e--;
*e = '\0';
s = malloc(sizeof *s + strlen(p) + 1);
AN(s);
s->a = a;
s->n = (void*)(s + 1);
strcpy(s->n, p);
VTAILQ_INSERT_TAIL(&symbols, s, list);
}
(void)pclose(fi);
}
/*--------------------------------------------------------------------*/
......
......@@ -250,14 +250,18 @@ vcc_acl_try_netnotation(struct tokenlist *tl, struct acl_e *ae)
{
unsigned char b[4];
int i, j, k;
unsigned u;
const char *p;
memset(b, 0, sizeof b);
p = ae->t_addr->dec;
for (i = 0; i < 4; i++) {
j = sscanf(p, "%hhu%n", &b[i], &k);
j = sscanf(p, "%u%n", &u, &k);
if (j != 1)
return (0);
if (u & ~0xff)
return (0);
b[i] = (unsigned char)u;
if (p[k] == '\0')
break;
if (p[k] != '.')
......
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