version 1.36, 2014/12/01 21:58:46 |
version 1.37, 2015/01/16 06:40:11 |
|
|
* @(#)diffreg.c 8.1 (Berkeley) 6/6/93 |
* @(#)diffreg.c 8.1 (Berkeley) 6/6/93 |
*/ |
*/ |
|
|
#include <sys/param.h> |
|
#include <sys/stat.h> |
#include <sys/stat.h> |
|
|
#include <ctype.h> |
#include <ctype.h> |
#include <err.h> |
#include <err.h> |
#include <stdarg.h> |
#include <stdarg.h> |
|
#include <stdint.h> |
#include <stddef.h> |
#include <stddef.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <string.h> |
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
|
#include <limits.h> |
|
|
#include "buf.h" |
#include "buf.h" |
#include "diff.h" |
#include "diff.h" |
#include "xmalloc.h" |
#include "xmalloc.h" |
|
|
|
#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) |
|
#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) |
|
|
/* |
/* |
* diff - compare two files. |
* diff - compare two files. |
*/ |
*/ |
|
|
bound = UINT_MAX; |
bound = UINT_MAX; |
else { |
else { |
sq = isqrt(n); |
sq = isqrt(n); |
bound = MAX(256, sq); |
bound = MAXIMUM(256, sq); |
} |
} |
|
|
k = 0; |
k = 0; |
|
|
return; |
return; |
|
|
b = d = 0; /* gcc */ |
b = d = 0; /* gcc */ |
lowa = MAX(1, cvp->a - diff_context); |
lowa = MAXIMUM(1, cvp->a - diff_context); |
upb = MIN(len[0], context_vec_ptr->b + diff_context); |
upb = MINIMUM(len[0], context_vec_ptr->b + diff_context); |
lowc = MAX(1, cvp->c - diff_context); |
lowc = MAXIMUM(1, cvp->c - diff_context); |
upd = MIN(len[1], context_vec_ptr->d + diff_context); |
upd = MINIMUM(len[1], context_vec_ptr->d + diff_context); |
|
|
diff_output("***************"); |
diff_output("***************"); |
if ((flags & D_PROTOTYPE)) { |
if ((flags & D_PROTOTYPE)) { |
|
|
return; |
return; |
|
|
d = 0; /* gcc */ |
d = 0; /* gcc */ |
lowa = MAX(1, cvp->a - diff_context); |
lowa = MAXIMUM(1, cvp->a - diff_context); |
upb = MIN(len[0], context_vec_ptr->b + diff_context); |
upb = MINIMUM(len[0], context_vec_ptr->b + diff_context); |
lowc = MAX(1, cvp->c - diff_context); |
lowc = MAXIMUM(1, cvp->c - diff_context); |
upd = MIN(len[1], context_vec_ptr->d + diff_context); |
upd = MINIMUM(len[1], context_vec_ptr->d + diff_context); |
|
|
diff_output("@@ -"); |
diff_output("@@ -"); |
uni_range(lowa, upb); |
uni_range(lowa, upb); |