diff options
author | deraadt@openbsd.org <deraadt@openbsd.org> | 2016-09-12 01:22:38 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2016-09-12 13:46:29 +1000 |
commit | 9136ec134c97a8aff2917760c03134f52945ff3c (patch) | |
tree | bfcab357e6e0f510d9b63bac43b18097e89fa58a /krl.c | |
parent | f219fc8f03caca7ac82a38ed74bbd6432a1195e7 (diff) |
upstream commit
Add MAXIMUM(), MINIMUM(), and ROUNDUP() to misc.h, then
use those definitions rather than pulling <sys/param.h> and unknown namespace
pollution. ok djm markus dtucker
Upstream-ID: 712cafa816c9f012a61628b66b9fbd5687223fb8
Diffstat (limited to 'krl.c')
-rw-r--r-- | krl.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -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 <sys/param.h> /* MIN */ #include <sys/types.h> #include <openbsd-compat/sys-tree.h> #include <openbsd-compat/sys-queue.h> @@ -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; |