From owner-dev-commits-src-branches@freebsd.org Wed May 5 08:38:19 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51BF86357F6; Wed, 5 May 2021 08:38:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FZqqH11PKz3L6Y; Wed, 5 May 2021 08:38:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D132219BD; Wed, 5 May 2021 08:38:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1458cI7n043639; Wed, 5 May 2021 08:38:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1458cIC0043638; Wed, 5 May 2021 08:38:18 GMT (envelope-from git) Date: Wed, 5 May 2021 08:38:18 GMT Message-Id: <202105050838.1458cIC0043638@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 0ce985a23b50 - stable/13 - diff: eliminate space at end of line MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0ce985a23b505750faa446ebf7dae177bf3f88c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 May 2021 08:38:19 -0000 The branch stable/13 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=0ce985a23b505750faa446ebf7dae177bf3f88c4 commit 0ce985a23b505750faa446ebf7dae177bf3f88c4 Author: Baptiste Daroussin AuthorDate: 2021-01-27 10:46:15 +0000 Commit: Baptiste Daroussin 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