Optimize diff -q.

Once we know whether the files differ, we don't need to do any further
work.

PR:		242828
Submitted by:	fehmi noyan isi <fnoyanisi@yahoo.com> (original version)
Reviewed by:	bapt, kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23152
This commit is contained in:
Mark Johnston 2020-01-13 18:29:47 +00:00
parent 2a345f61da
commit 5248d3b1b2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356695

View File

@ -349,6 +349,11 @@ diffreg(char *file1, char *file2, int flags, int capsicum)
goto closem;
}
if (diff_format == D_BRIEF) {
rval = D_DIFFER;
status |= 1;
goto closem;
}
if ((flags & D_FORCEASCII) == 0 &&
(!asciifile(f1) || !asciifile(f2))) {
rval = D_BINARY;