[master] eb0a7d33e Use bprintf() instead of handrolling it.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Dec 8 13:19:04 UTC 2025
commit eb0a7d33eed30a443ed7cf38ad357fe4c6bc7500
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Dec 8 13:18:30 2025 +0000
Use bprintf() instead of handrolling it.
diff --git a/vmod/vmod_directors_shard_cfg.c b/vmod/vmod_directors_shard_cfg.c
index 5f0c2f559..c464746f5 100644
--- a/vmod/vmod_directors_shard_cfg.c
+++ b/vmod/vmod_directors_shard_cfg.c
@@ -261,8 +261,7 @@ shardcfg_hashcircle(struct sharddir *shardd)
unsigned h;
uint32_t i, j, n_points, r, rmax;
const char *ident;
- const int len = 12; // log10(UINT32_MAX) + 2;
- char s[len];
+ char s[12]; // log10(UINT32_MAX) + 2;
CHECK_OBJ_NOTNULL(shardd, SHARDDIR_MAGIC);
AZ(shardd->hashcircle);
@@ -294,7 +293,7 @@ shardcfg_hashcircle(struct sharddir *shardd)
r = vmin_t(uint32_t, b->replicas, rmax);
for (j = 0; j < r; j++) {
- assert(snprintf(s, len, "%d", j) < len);
+ bprintf(s, "%d", j);
assert (i < n_points);
shardd->hashcircle[i].point =
VRT_HashStrands32(TOSTRANDS(2, ident, s));
More information about the varnish-commit
mailing list