git: 190c4c2499e6 - main - diff3: Use ranges for new and old diffedits in ed scripts
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 02 Aug 2022 13:39:12 UTC
The branch main has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=190c4c2499e64e1c88f25f68c2929d110d635300 commit 190c4c2499e64e1c88f25f68c2929d110d635300 Author: Tom Jones <thj@FreeBSD.org> AuthorDate: 2022-08-02 13:33:17 +0000 Commit: Tom Jones <thj@FreeBSD.org> CommitDate: 2022-08-02 13:38:11 +0000 diff3: Use ranges for new and old diffedits in ed scripts This should make the output logic easier to read. No functional change intended. Sponsored by: Klara, Inc. --- usr.bin/diff3/diff3.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/usr.bin/diff3/diff3.c b/usr.bin/diff3/diff3.c index fa0aeb11d008..d52678846fae 100644 --- a/usr.bin/diff3/diff3.c +++ b/usr.bin/diff3/diff3.c @@ -593,22 +593,26 @@ static void edscript(int n) { bool delete; + struct range *new, *old; for (; n > 0; n--) { - delete = (de[n].new.from == de[n].new.to); + new = &de[n].new; + old = &de[n].old; + + delete = (new->from == new->to); if (!oflag || !overlap[n]) { - prange(&de[n].old, delete); + prange(old, delete); } else { - printf("%da\n", de[n].old.to - 1); + printf("%da\n", old->to - 1); printf("%s\n", divider); } - printrange(fp[2], &de[n].new); + printrange(fp[2], new); if (!oflag || !overlap[n]) { if (!delete) printf(".\n"); } else { printf("%s %s\n.\n", newmark, f3mark); - printf("%da\n%s %s\n.\n", de[n].old.from - 1, + printf("%da\n%s %s\n.\n", old->from - 1, oldmark, f1mark); } }