[master] 4110be9a2 Make SETTINGS_MAX automatically track the settings we have implemented

Poul-Henning Kamp phk at FreeBSD.org
Mon Jul 1 07:24:09 UTC 2019


commit 4110be9a23eedede734101670cc62c5cb5dac08d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jul 1 07:22:39 2019 +0000

    Make SETTINGS_MAX automatically track the settings we have implemented
    
    Not really spotted by:  Coverity

diff --git a/bin/varnishtest/vtc_http2.c b/bin/varnishtest/vtc_http2.c
index 41baa8803..74cea13bb 100644
--- a/bin/varnishtest/vtc_http2.c
+++ b/bin/varnishtest/vtc_http2.c
@@ -61,8 +61,6 @@ static const char *const h2_types[] = {
 	NULL
 };
 
-#define SETTINGS_MAX 0x06
-
 static const char * const h2_settings[] = {
 	[0] = "unknown",
 #define H2_SETTING(U,l,v,...) [v] = #U,
@@ -70,6 +68,9 @@ static const char * const h2_settings[] = {
 	NULL
 };
 
+#define SETTINGS_MAX (sizeof(h2_settings)/sizeof(h2_settings[0]) - 1U)
+
+
 enum h2_type {
 #define H2_FRAME(l,u,t,f,...) TYPE_##u = t,
 #include <tbl/h2_frames.h>
@@ -569,8 +570,8 @@ static void
 parse_settings(const struct stream *s, struct frame *f)
 {
 	struct http *hp;
-	int t, v;
-	unsigned u;
+	int v;
+	unsigned u, t;
 	const char *buf;
 	enum hpk_result r;
 	CHECK_OBJ_NOTNULL(f, FRAME_MAGIC);
@@ -600,7 +601,7 @@ parse_settings(const struct stream *s, struct frame *f)
 			assert(r == hpk_done);
 		}
 
-		vtc_log(hp->vl, 4, "settings->%s (%d): %d", buf, t, v);
+		vtc_log(hp->vl, 4, "settings->%s (%u): %d", buf, t, v);
 	}
 
 }


More information about the varnish-commit mailing list