From 9136ec134c97a8aff2917760c03134f52945ff3c Mon Sep 17 00:00:00 2001 From: "deraadt@openbsd.org" Date: Mon, 12 Sep 2016 01:22:38 +0000 Subject: upstream commit Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then use those definitions rather than pulling and unknown namespace pollution. ok djm markus dtucker Upstream-ID: 712cafa816c9f012a61628b66b9fbd5687223fb8 --- krl.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'krl.c') diff --git a/krl.c b/krl.c index fff1a3f7c..e271a1934 100644 --- a/krl.c +++ b/krl.c @@ -14,11 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $OpenBSD: krl.c,v 1.37 2015/12/31 00:33:52 djm Exp $ */ +/* $OpenBSD: krl.c,v 1.38 2016/09/12 01:22:38 deraadt Exp $ */ #include "includes.h" -#include /* MIN */ #include #include #include @@ -121,7 +120,7 @@ blob_cmp(struct revoked_blob *a, struct revoked_blob *b) int r; if (a->len != b->len) { - if ((r = memcmp(a->blob, b->blob, MIN(a->len, b->len))) != 0) + if ((r = memcmp(a->blob, b->blob, MINIMUM(a->len, b->len))) != 0) return r; return a->len > b->len ? 1 : -1; } else @@ -458,9 +457,9 @@ choose_next_state(int current_state, u_int64_t contig, int final, * Avoid unsigned overflows. * The limits are high enough to avoid confusing the calculations. */ - contig = MIN(contig, 1ULL<<31); - last_gap = MIN(last_gap, 1ULL<<31); - next_gap = MIN(next_gap, 1ULL<<31); + contig = MINIMUM(contig, 1ULL<<31); + last_gap = MINIMUM(last_gap, 1ULL<<31); + next_gap = MINIMUM(next_gap, 1ULL<<31); /* * Calculate the cost to switch from the current state to candidates. @@ -486,8 +485,8 @@ choose_next_state(int current_state, u_int64_t contig, int final, /* Estimate base cost in bits of each section type */ cost_list += 64 * contig + (final ? 0 : 8+64); cost_range += (2 * 64) + (final ? 0 : 8+64); - cost_bitmap += last_gap + contig + (final ? 0 : MIN(next_gap, 8+64)); - cost_bitmap_restart += contig + (final ? 0 : MIN(next_gap, 8+64)); + cost_bitmap += last_gap + contig + (final ? 0 : MINIMUM(next_gap, 8+64)); + cost_bitmap_restart += contig + (final ? 0 : MINIMUM(next_gap, 8+64)); /* Convert to byte costs for actual comparison */ cost_list = (cost_list + 7) / 8; -- cgit v1.2.3