diff: restyle loop a bit

This is a bit more readable, and this loop is probably unlikely to gain
any `continue` or `break`s.

Suggested by:	pstef
Differential Revision:	https://reviews.freebsd.org/D37676
This commit is contained in:
Kyle Evans 2022-12-13 19:31:21 -06:00
parent 8bf187f35b
commit 54d65fdd56

View File

@ -1246,9 +1246,9 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags)
else if (diff_format != D_UNIFIED)
printf(" ");
}
col = 0;
for (j = 0, lastc = '\0'; j < nc && (hw == 0 || col < hw);
j++, lastc = c) {
col = j = 0;
lastc = '\0';
while (j < nc && (hw == 0 || col < hw)) {
c = getc(lb);
if (flags & D_STRIPCR && c == '\r') {
if ((c = getc(lb)) == '\n')
@ -1313,6 +1313,9 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags)
col++;
}
}
j++;
lastc = c;
}
}
if (color && diff_format == D_SIDEBYSIDE)