Coccinelle: patch v{min,max}_t -> v{min,max}

parent b76e25bd
......@@ -304,7 +304,7 @@ VSLv(enum VSL_tag_e tag, vxid_t vxid, const char *fmt, va_list ap)
vslr(tag, vxid, fmt, strlen(fmt) + 1);
} else {
n = vsnprintf(buf, mlen, fmt, ap);
n = vmin_t(unsigned, n, mlen - 1);
n = vmin(n, mlen - 1);
buf[n++] = '\0'; /* NUL-terminated */
vslr(tag, vxid, buf, n);
}
......
......@@ -272,7 +272,7 @@ h2_do_window(struct worker *wrk, struct h2_req *r2,
(void)h2_cond_wait(h2->winupd_cond, h2, r2);
if (h2_errcheck(r2, h2) == 0) {
w = vmin_t(int64_t, h2_win_limit(r2, h2), wanted);
w = vmin(h2_win_limit(r2, h2), wanted);
h2_win_charge(r2, h2, w);
assert (w > 0);
}
......
......@@ -157,7 +157,7 @@ STV_FileSize(int fd, const char *size, unsigned *granularity, const char *ctx)
AZ(VFIL_fsinfo(fd, &bs, &fssize, NULL));
/* Increase granularity if it is lower than the filesystem block size */
*granularity = vmax_t(unsigned, *granularity, bs);
*granularity = vmax(*granularity, bs);
if ((size == NULL || *size == '\0') && st.st_size != 0) {
/*
......
......@@ -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_t(unsigned, ae1->mask, ae2->mask);
m = vmin(ae1->mask, ae2->mask);
for (; m >= 8; m -= 8) {
CMP(*p1, *p2);
p1++;
......
/*
* This patch refactors v{min,max}_t to v{min,max} where types agree
*
* Note: Has false positives on pointer types, tolerated for clarity
*/
using "varnish.iso"
@@ type T; T e1, e2; @@
- vmin_t(T, e1, e2)
+ vmin(e1, e2)
@@ type T; T e1, e2; @@
- vmax_t(T, e1, e2)
+ vmax(e1, e2)
......@@ -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_t(uint32_t, b->replicas, rmax);
n_points += vmin(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_t(uint32_t, b->replicas, rmax);
r = vmin(b->replicas, rmax);
for (j = 0; j < r; j++) {
assert(snprintf(s, len, "%d", j) < len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment