diff options
author | 2015-01-16 06:39:28 +0000 | |
---|---|---|
committer | 2015-01-16 06:39:28 +0000 | |
commit | b9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch) | |
tree | 72b2433e418dfa1aef5fcf8305617b97979a25d8 /usr.bin/cvs/diff_internals.c | |
parent | improve checksum parsing slightly. now handles filenames with spaces. (diff) | |
download | wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip |
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'usr.bin/cvs/diff_internals.c')
-rw-r--r-- | usr.bin/cvs/diff_internals.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/usr.bin/cvs/diff_internals.c b/usr.bin/cvs/diff_internals.c index 706415acbb5..1b34d922a65 100644 --- a/usr.bin/cvs/diff_internals.c +++ b/usr.bin/cvs/diff_internals.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff_internals.c,v 1.35 2014/12/01 21:58:46 deraadt Exp $ */ +/* $OpenBSD: diff_internals.c,v 1.36 2015/01/16 06:40:07 deraadt Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -64,7 +64,7 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ -#include <sys/param.h> +#include <sys/types.h> #include <sys/stat.h> #include <ctype.h> @@ -79,6 +79,9 @@ #include "cvs.h" #include "diff.h" +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) +#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) + /* * diff - compare two files. */ @@ -545,7 +548,7 @@ stone(int *a, int n, int *b, int *c, int flags) bound = UINT_MAX; else { sq = isqrt(n); - bound = MAX(256, sq); + bound = MAXIMUM(256, sq); } k = 0; @@ -1273,10 +1276,10 @@ dump_context_vec(FILE *f1, FILE *f2, int flags) return; b = d = 0; /* gcc */ - lowa = MAX(1, cvp->a - diff_context); - upb = MIN(len[0], context_vec_ptr->b + diff_context); - lowc = MAX(1, cvp->c - diff_context); - upd = MIN(len[1], context_vec_ptr->d + diff_context); + lowa = MAXIMUM(1, cvp->a - diff_context); + upb = MINIMUM(len[0], context_vec_ptr->b + diff_context); + lowc = MAXIMUM(1, cvp->c - diff_context); + upd = MINIMUM(len[1], context_vec_ptr->d + diff_context); diff_output("***************"); if ((flags & D_PROTOTYPE)) { @@ -1376,10 +1379,10 @@ dump_unified_vec(FILE *f1, FILE *f2, int flags) return; b = d = 0; /* gcc */ - lowa = MAX(1, cvp->a - diff_context); - upb = MIN(len[0], context_vec_ptr->b + diff_context); - lowc = MAX(1, cvp->c - diff_context); - upd = MIN(len[1], context_vec_ptr->d + diff_context); + lowa = MAXIMUM(1, cvp->a - diff_context); + upb = MINIMUM(len[0], context_vec_ptr->b + diff_context); + lowc = MAXIMUM(1, cvp->c - diff_context); + upd = MINIMUM(len[1], context_vec_ptr->d + diff_context); diff_output("@@ -"); uni_range(lowa, upb); |