X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fhmap.c;h=542d8b5a8eb73550df8cb2322b9eb434a6f69bc9;hb=c5cf10598f8c9f4428291e9df3ecd72a05fb1ccf;hp=a559a77a57f121faf75e3623d5eb5774e58d8336;hpb=0c5e05bf515ceb5e3e4f7f01834054bb34519752;p=sliver-openvswitch.git diff --git a/lib/hmap.c b/lib/hmap.c index a559a77a5..542d8b5a8 100644 --- a/lib/hmap.c +++ b/lib/hmap.c @@ -114,7 +114,7 @@ resize(struct hmap *hmap, size_t new_mask, const char *where) if (count > 5) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(10, 10); COVERAGE_INC(hmap_pathological); - VLOG_DBG_RL(&rl, "%s: %d nodes in bucket (%zu nodes, %zu buckets)", + VLOG_DBG_RL(&rl, "%s: %d nodes in bucket (%"PRIuSIZE" nodes, %"PRIuSIZE" buckets)", where, count, hmap->n, hmap->mask + 1); } } @@ -214,8 +214,8 @@ hmap_random_node(const struct hmap *hmap) size_t n, i; /* Choose a random non-empty bucket. */ - for (i = random_uint32(); ; i++) { - bucket = hmap->buckets[i & hmap->mask]; + for (;;) { + bucket = hmap->buckets[random_uint32() & hmap->mask]; if (bucket) { break; }