Date: Wed, 5 May 2021 08:38:18 GMT From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 0ce985a23b50 - stable/13 - diff: eliminate space at end of line Message-ID: <202105050838.1458cIC0043638@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=0ce985a23b505750faa446ebf7dae177bf3f88c4 commit 0ce985a23b505750faa446ebf7dae177bf3f88c4 Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2021-01-27 10:46:15 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2021-05-05 08:37:08 +0000 diff: eliminate space at end of line No functionnal changes (cherry picked from commit 15abb23286541c17ff95bac056cd4979822c4288) --- usr.bin/diff/diffreg.c | 66 +++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 4e887ab27c7b..e6b36697fb28 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -268,17 +268,17 @@ diffreg(char *file1, char *file2, int flags, int capsicum) lastmatchline = 0; context_vec_ptr = context_vec_start - 1; - /* - * hw excludes padding and make sure when -t is not used, + /* + * hw excludes padding and make sure when -t is not used, * the second column always starts from the closest tab stop */ - if (diff_format == D_SIDEBYSIDE) { + if (diff_format == D_SIDEBYSIDE) { hw = width >> 1; padding = tabsize - (hw % tabsize); if ((flags & D_EXPANDTABS) != 0 || (padding % tabsize == 0)) padding = MIN_PAD; - hw = (width >> 1) - + hw = (width >> 1) - ((padding == MIN_PAD) ? (padding << 1) : padding) - 1; } @@ -902,14 +902,14 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) if (diff_format != D_EDIT) { for (i0 = 1; i0 <= m; i0 = i1 + 1) { while (i0 <= m && J[i0] == J[i0 - 1] + 1){ - if (diff_format == D_SIDEBYSIDE && + if (diff_format == D_SIDEBYSIDE && suppress_common != 1) { - nc = fetch(ixold, i0, i0, f1, '\0', + nc = fetch(ixold, i0, i0, f1, '\0', 1, flags); - print_space(nc, - (hw - nc) + (padding << 1) + 1, + print_space(nc, + (hw - nc) + (padding << 1) + 1, flags); - fetch(ixnew, J[i0], J[i0], f2, '\0', + fetch(ixnew, J[i0], J[i0], f2, '\0', 0, flags); diff_output("\n"); } @@ -923,32 +923,32 @@ output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) J[i1] = j1; /* - * When using side-by-side, lines from both of the - * files are printed. The algorithm used by diff(1) - * identifies the ranges in which two files differ. - * See the change() function below. - * The for loop below consumes the shorter range, - * whereas one of the while loops deals with the + * When using side-by-side, lines from both of the + * files are printed. The algorithm used by diff(1) + * identifies the ranges in which two files differ. + * See the change() function below. + * The for loop below consumes the shorter range, + * whereas one of the while loops deals with the * longer one. */ if (diff_format == D_SIDEBYSIDE) { - for (i=i0, j=j0; i<=i1 && j<=j1; i++, j++) - change(file1, f1, file2, f2, i, i, + for (i=i0, j=j0; i<=i1 && j<=j1; i++, j++) + change(file1, f1, file2, f2, i, i, j, j, &flags); while (i <= i1) { - change(file1, f1, file2, f2, + change(file1, f1, file2, f2, i, i, j+1, j, &flags); i++; } while (j <= j1) { - change(file1, f1, file2, f2, + change(file1, f1, file2, f2, i+1, i, j, j, &flags); j++; } } else - change(file1, f1, file2, f2, i0, i1, j0, + change(file1, f1, file2, f2, i0, i1, j0, j1, &flags); } } else { @@ -1188,10 +1188,10 @@ proceed: print_space(0, hw + padding , *pflags); } else { nc = fetch(ixold, a, b, f1, '\0', 1, *pflags); - print_space(nc, hw - nc + padding, *pflags); + print_space(nc, hw - nc + padding, *pflags); } diff_output("%c", (a>b)? '>' : ((c>d)? '<' : '|')); - print_space(hw + padding + 1 , padding, *pflags); + print_space(hw + padding + 1 , padding, *pflags); fetch(ixnew, c, d, f2, '\0', 0, *pflags); diff_output("\n"); } @@ -1260,13 +1260,13 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) for (i = a; i <= b; i++) { fseek(lb, f[i - 1], SEEK_SET); nc = (f[i] - f[i - 1]); - if (diff_format == D_SIDEBYSIDE && hw < nc) + if (diff_format == D_SIDEBYSIDE && hw < nc) nc = hw; - if ((diff_format != D_IFDEF && diff_format != D_GFORMAT) && + if ((diff_format != D_IFDEF && diff_format != D_GFORMAT) && ch != '\0') { diff_output("%c", ch); - if (Tflag && (diff_format == D_NORMAL || - diff_format == D_CONTEXT || + if (Tflag && (diff_format == D_NORMAL || + diff_format == D_CONTEXT || diff_format == D_UNIFIED)) diff_output("\t"); else if (diff_format != D_UNIFIED) @@ -1275,7 +1275,7 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) col = 0; for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { if ((c = getc(lb)) == EOF) { - if (diff_format == D_EDIT || + if (diff_format == D_EDIT || diff_format == D_REVERSE || diff_format == D_NREVERSE) warnx("No newline at end of file"); @@ -1284,8 +1284,8 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) "file\n"); return col; } - /* - * when using --side-by-side, col needs to be increased + /* + * when using --side-by-side, col needs to be increased * in any case to keep the columns aligned */ if (c == '\t') { @@ -1297,9 +1297,9 @@ fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile, int flags) diff_output(" "); } while (++col < newcol && j < nc); } else { - if (diff_format == D_SIDEBYSIDE) { + if (diff_format == D_SIDEBYSIDE) { if ((j + tabsize) > nc) { - diff_output("%*s", + diff_output("%*s", nc - j,""); j = col = nc; } else { @@ -1691,9 +1691,9 @@ print_header(const char *file1, const char *file2) file2, buf2); } -/* +/* * Prints n number of space characters either by using tab - * or single space characters. + * or single space characters. * nc is the preceding number of characters */ static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105050838.1458cIC0043638>