[master] 93b6f31 Clean up mistakes from d63c53e.

Lasse Karstensen lkarsten at varnish-software.com
Thu Sep 4 14:14:33 CEST 2014


commit 93b6f318841f14d3949587124ca3c10cba4c0355
Author: Lasse Karstensen <lkarsten at varnish-software.com>
Date:   Thu Sep 4 14:04:34 2014 +0200

    Clean up mistakes from d63c53e.
    
    Add missing braces, avoid unnecessary variables.
    
    Noticed by:	fgs

diff --git a/lib/libvarnish/vlu.c b/lib/libvarnish/vlu.c
index 5498f11..c983442 100644
--- a/lib/libvarnish/vlu.c
+++ b/lib/libvarnish/vlu.c
@@ -96,7 +96,6 @@ vlu_dotelnet(struct vlu *l, char *p)
 	char *e;
 	char tno[3];
 	int i;
-	ssize_t r = 0;
 
 	e = l->buf + l->bufp;
 	assert(p >= l->buf && p < e);
@@ -121,8 +120,7 @@ vlu_dotelnet(struct vlu *l, char *p)
 		/* Return WONT for these */
 		memcpy(tno, p, 3);
 		tno[1] = (char)252;
-		r = write(l->telnet, tno, 3);
-		if (r != 3)
+		if (write(l->telnet, tno, 3) != 3)
 			return (1);
 		i = 3;
 		break;
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index 7319253..949028f 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -408,8 +408,6 @@ VSL_WriteOpen(struct VSL_data *vsl, const char *name, int append, int unbuf)
 {
 	const char head[] = VSL_FILE_ID;
 	FILE* f;
-	size_t r = 0;
-
 	f = fopen(name, append ? "a" : "w");
 	if (f == NULL) {
 		vsl_diag(vsl, "%s", strerror(errno));
@@ -417,13 +415,13 @@ VSL_WriteOpen(struct VSL_data *vsl, const char *name, int append, int unbuf)
 	}
 	if (unbuf)
 		setbuf(f, NULL);
-	if (0 == ftell(f))
-		r = fwrite(head, 1, sizeof head, f);
-		if (r != sizeof head) {
+	if (0 == ftell(f)) {
+		if (fwrite(head, 1, sizeof head, f) != sizeof head) {
 			vsl_diag(vsl, "%s", strerror(errno));
 			fclose(f);
 			return (NULL);
 		}
+	}
 	return (f);
 }
 



More information about the varnish-commit mailing list