[4.0] 41b9a00 Reintroduce code to handle -f option

Martin Blix Grydeland martin at varnish-software.com
Thu Mar 13 10:24:22 CET 2014


commit 41b9a000e2999c7d078bd266b1fa0a58df65f78f
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Jan 29 15:09:00 2014 +0100

    Reintroduce code to handle -f option

diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c
index 7190257..3863119 100644
--- a/bin/varnishtop/varnishtop.c
+++ b/bin/varnishtop/varnishtop.c
@@ -131,13 +131,18 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
 				continue;
 			tag = VSL_TAG(tr->c->rec.ptr);
 			b = VSL_CDATA(tr->c->rec.ptr);
-			len = VSL_LEN(tr->c->rec.ptr);
-			assert(len > 0);
-			e = b + len;
+			e = b + VSL_LEN(tr->c->rec.ptr);
 			u = 0;
 			for (p = b; p <= e; p++) {
+				if (*p == '\0')
+					break;
+				if (f_flag && (*p == ':' || isspace(*p)))
+					break;
 				u += *p;
 			}
+			len = p - b;
+			if (len == 0)
+				continue;
 
 			t.hash = u;
 			t.tag = tag;



More information about the varnish-commit mailing list