[6.0] 3ffc27d53 Slight polish

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:05 UTC 2018


commit 3ffc27d53c033086a0621d6f354704375b6d581d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Aug 22 07:11:46 2018 +0000

    Slight polish
    
    Conflicts:
            lib/libvmod_blob/hex.c

diff --git a/lib/libvmod_blob/hex.c b/lib/libvmod_blob/hex.c
index 4124100f4..614404d9e 100644
--- a/lib/libvmod_blob/hex.c
+++ b/lib/libvmod_blob/hex.c
@@ -108,7 +108,7 @@ hex_decode(const enum encoding dec, char *restrict const buf,
 	char *dest = buf;
 	const char *b;
 	unsigned char extranib = 0;
-	ssize_t len = 0;
+	size_t len = 0;
 	va_list ap2;
 
 	AN(buf);
@@ -122,26 +122,20 @@ hex_decode(const enum encoding dec, char *restrict const buf,
 		b = s;
 		while (*s) {
 			if (!isxdigit(*s++)) {
-				len = -1;
-				break;
+				errno = EINVAL;
+				return (-1);
 			}
 		}
-		if (len == -1)
-			break;
 		len += s - b;
 	}
 	va_end(ap2);
 
 	if (len == 0)
 		return 0;
-	if (len == -1) {
-		errno = EINVAL;
-		return -1;
-	}
 	if (n != -1 && len > n)
 		len = n;
 
-	if ((len+1) >> 1 > buflen) {
+	if (((len+1) >> 1) > buflen) {
 		errno = ENOMEM;
 		return -1;
 	}


More information about the varnish-commit mailing list