Commit 70100e5c authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

FlexeLint cleanups


git-svn-id: http://www.varnish-cache.org/svn/trunk@214 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 3dfa3d6c
...@@ -300,7 +300,7 @@ IdIs(struct token *t, const char *p) ...@@ -300,7 +300,7 @@ IdIs(struct token *t, const char *p)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
char * static char *
EncString(struct token *t) EncString(struct token *t)
{ {
char *p, *q; char *p, *q;
...@@ -564,6 +564,7 @@ HeaderVar(struct tokenlist *tl, struct token *t, struct var *vh) ...@@ -564,6 +564,7 @@ HeaderVar(struct tokenlist *tl, struct token *t, struct var *vh)
int i; int i;
v = calloc(sizeof *v, 1); v = calloc(sizeof *v, 1);
assert(v != NULL);
i = t->e - t->b; i = t->e - t->b;
p = malloc(i + 1); p = malloc(i + 1);
assert(p != NULL); assert(p != NULL);
...@@ -1219,7 +1220,6 @@ Backend(struct tokenlist *tl) ...@@ -1219,7 +1220,6 @@ Backend(struct tokenlist *tl)
case HOSTNAME: case HOSTNAME:
ExpectErr(tl, CSTR); ExpectErr(tl, CSTR);
t_host = tl->t; t_host = tl->t;
host = EncString(tl->t);
I(tl); sbuf_printf(tl->fc, "\tp = %*.*s;\n", I(tl); sbuf_printf(tl->fc, "\tp = %*.*s;\n",
tl->t->e - tl->t->b, tl->t->e - tl->t->b,
tl->t->e - tl->t->b, tl->t->b); tl->t->e - tl->t->b, tl->t->b);
...@@ -1231,7 +1231,6 @@ Backend(struct tokenlist *tl) ...@@ -1231,7 +1231,6 @@ Backend(struct tokenlist *tl)
case PORTNAME: case PORTNAME:
ExpectErr(tl, CSTR); ExpectErr(tl, CSTR);
t_port = tl->t; t_port = tl->t;
port = EncString(tl->t);
I(tl); sbuf_printf(tl->fc, "\tp = %*.*s;\n", I(tl); sbuf_printf(tl->fc, "\tp = %*.*s;\n",
tl->t->e - tl->t->b, tl->t->e - tl->t->b,
tl->t->e - tl->t->b, tl->t->b); tl->t->e - tl->t->b, tl->t->b);
...@@ -1250,13 +1249,14 @@ Backend(struct tokenlist *tl) ...@@ -1250,13 +1249,14 @@ Backend(struct tokenlist *tl)
NextToken(tl); NextToken(tl);
} }
ExpectErr(tl, '}'); ExpectErr(tl, '}');
if (host == NULL) { if (t_host == NULL) {
sbuf_printf(tl->sb, "Backend '%*.*s' has no hostname\n", sbuf_printf(tl->sb, "Backend '%*.*s' has no hostname\n",
t_be->e - t_be->b, t_be->e - t_be->b,
t_be->e - t_be->b, t_be->b); t_be->e - t_be->b, t_be->b);
ErrWhere(tl, tl->t); ErrWhere(tl, tl->t);
return; return;
} }
host = EncString(t_host);
ep = CheckHostPort(host, "80"); ep = CheckHostPort(host, "80");
if (ep != NULL) { if (ep != NULL) {
sbuf_printf(tl->sb, sbuf_printf(tl->sb,
...@@ -1266,7 +1266,8 @@ Backend(struct tokenlist *tl) ...@@ -1266,7 +1266,8 @@ Backend(struct tokenlist *tl)
ErrWhere(tl, t_host); ErrWhere(tl, t_host);
return; return;
} }
if (port != NULL) { if (t_port != NULL) {
port = EncString(tl->t);
ep = CheckHostPort(host, port); ep = CheckHostPort(host, port);
if (ep != NULL) { if (ep != NULL) {
sbuf_printf(tl->sb, sbuf_printf(tl->sb,
......
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