[master] cef6d49bd Polish min usage for SunCC

Nils Goroll nils.goroll at uplex.de
Tue Jul 11 19:46:05 UTC 2023


commit cef6d49bdee501dd452c60bd63ad2be870ad1453
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Nov 8 18:01:38 2021 +0100

    Polish min usage for SunCC
    
    Fixes: left operand must be modifiable lvalue: op "="
    
    Same as: 64f7181b1d337309e2bcae8a10be5f626f009e36
    
    This leaves exactly one commit after the coccinelle efforts.
    What a waste of time. :|

diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c
index 85baac4ca..818693670 100644
--- a/lib/libvcc/vcc_acl.c
+++ b/lib/libvcc/vcc_acl.c
@@ -105,7 +105,7 @@ vcl_acl_cmp(const struct acl_e *ae1, const struct acl_e *ae2)
 
 	p1 = ae1->data;
 	p2 = ae2->data;
-	m = vmin(ae1->mask, ae2->mask);
+	m = vmin_t(unsigned, ae1->mask, ae2->mask);
 	for (; m >= 8; m -= 8) {
 		CMP(*p1, *p2);
 		p1++;
diff --git a/vmod/vmod_directors_shard_cfg.c b/vmod/vmod_directors_shard_cfg.c
index f03a96361..aec4a0901 100644
--- a/vmod/vmod_directors_shard_cfg.c
+++ b/vmod/vmod_directors_shard_cfg.c
@@ -275,7 +275,7 @@ shardcfg_hashcircle(struct sharddir *shardd)
 	rmax = (UINT32_MAX - 1) / shardd->n_backend;
 	for (b = backends; b < backends + shardd->n_backend; b++) {
 		CHECK_OBJ_NOTNULL(b->backend, DIRECTOR_MAGIC);
-		n_points += vmin(b->replicas, rmax);
+		n_points += vmin_t(uint32_t, b->replicas, rmax);
 	}
 
 	assert(n_points < UINT32_MAX);
@@ -291,7 +291,7 @@ shardcfg_hashcircle(struct sharddir *shardd)
 		AN(ident);
 		assert(ident[0] != '\0');
 
-		r = vmin(b->replicas, rmax);
+		r = vmin_t(uint32_t, b->replicas, rmax);
 
 		for (j = 0; j < r; j++) {
 			assert(snprintf(s, len, "%d", j) < len);


More information about the varnish-commit mailing list