[master] e148a5ef6 flexelinting

Nils Goroll nils.goroll at uplex.de
Wed Jun 10 07:06:07 UTC 2020


commit e148a5ef6b1248b5e2535e553f2264c2c79f34ef
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Jun 10 09:05:24 2020 +0200

    flexelinting

diff --git a/lib/libvmod_directors/shard_cfg.c b/lib/libvmod_directors/shard_cfg.c
index 3f478ecf1..ced267c60 100644
--- a/lib/libvmod_directors/shard_cfg.c
+++ b/lib/libvmod_directors/shard_cfg.c
@@ -244,8 +244,8 @@ static void
 shardcfg_hashcircle(struct sharddir *shardd)
 {
 	const struct shard_backend *backends, *b;
-	int j, h;
-	uint32_t i, n_points, r, rmax;
+	int h;
+	uint32_t i, j, n_points, r, rmax;
 	const char *ident;
 	const int len = 12; // log10(UINT32_MAX) + 2;
 	char s[len];
@@ -578,7 +578,8 @@ shardcfg_apply_change(VRT_CTX, struct sharddir *shardd,
 				if (replicas * task->weight > UINT32_MAX)
 					b_replicas = UINT32_MAX;
 				else
-					b_replicas = replicas * task->weight;
+					b_replicas = (uint32_t) // flint
+						(replicas * task->weight);
 
 				shardcfg_backend_add(&re, task->priv,
 				    b_replicas);
diff --git a/lib/libvmod_directors/shard_dir.c b/lib/libvmod_directors/shard_dir.c
index 2c688d949..1c5f7d193 100644
--- a/lib/libvmod_directors/shard_dir.c
+++ b/lib/libvmod_directors/shard_dir.c
@@ -259,7 +259,7 @@ init_state(struct shard_state *state,
 
 	state->ctx = ctx;
 	state->shardd = shardd;
-	state->idx = -1;
+	state->idx = UINT32_MAX;
 	state->picklist = picklist;
 
 	/* healhy and changed only defined for hostid != -1 */
@@ -319,8 +319,9 @@ sharddir_pick_be_locked(VRT_CTX, const struct sharddir *shardd, uint32_t key,
 	validate_alt(ctx, shardd, &alt);
 
 	state->idx = shard_lookup(shardd, key);
+	assert(state->idx < UINT32_MAX);
 
-	SHDBG(SHDBG_LOOKUP, shardd, "lookup key %x idx %d host %u",
+	SHDBG(SHDBG_LOOKUP, shardd, "lookup key %x idx %u host %u",
 	    key, state->idx, shardd->hashcircle[state->idx].host);
 
 	if (alt > 0) {


More information about the varnish-commit mailing list