aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Jones <thj@FreeBSD.org>2022-08-02 13:23:10 +0000
committerTom Jones <thj@FreeBSD.org>2022-08-02 13:36:05 +0000
commit264a559ac827d0bf81986cd5758594fc687d5bd5 (patch)
treecae6d694d6bf862f22e13aa13573c0a041661d65
parent426afc8f521802400c3c9afd7e34d7331d0f42fd (diff)
downloadsrc-264a559ac827d0bf81986cd5758594fc687d5bd5.tar.gz
src-264a559ac827d0bf81986cd5758594fc687d5bd5.zip
diff3: Simplify startmark calculation in Ascript
Remove redundant calculation for startmark. Sponsored by: Klara, Inc.
-rw-r--r--usr.bin/diff3/diff3.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/diff3/diff3.c b/usr.bin/diff3/diff3.c
index ff8d03007e4e..37a98a635742 100644
--- a/usr.bin/diff3/diff3.c
+++ b/usr.bin/diff3/diff3.c
@@ -638,14 +638,13 @@ Ascript(int n)
old = &de[n].old;
deletenew = (new->from == new->to);
deleteold = (old->from == old->to);
- startmark = old->from + (old->to - old->from) - 1;
if (de[n].type == DIFF_TYPE2) {
if (!oflag || !overlap[n]) {
prange(old, deletenew);
printrange(fp[2], new);
} else {
- startmark = new->from + (new->to - new->from);
+ startmark = new->to;
if (!deletenew)
startmark--;
@@ -664,6 +663,8 @@ Ascript(int n)
}
} else if (de[n].type == DIFF_TYPE3) {
+ startmark = old->to - 1;
+
if (!oflag || !overlap[n]) {
prange(old, deletenew);
printrange(fp[2], new);