git: 264a559ac827 - main - diff3: Simplify startmark calculation in Ascript

From: Tom Jones <thj_at_FreeBSD.org>
Date: Tue, 02 Aug 2022 13:39:10 UTC
The branch main has been updated by thj:

URL: https://cgit.FreeBSD.org/src/commit/?id=264a559ac827d0bf81986cd5758594fc687d5bd5

commit 264a559ac827d0bf81986cd5758594fc687d5bd5
Author:     Tom Jones <thj@FreeBSD.org>
AuthorDate: 2022-08-02 13:23:10 +0000
Commit:     Tom Jones <thj@FreeBSD.org>
CommitDate: 2022-08-02 13:36:05 +0000

    diff3: Simplify startmark calculation in Ascript
    
    Remove redundant calculation for startmark.
    
    Sponsored by:   Klara, Inc.
---
 usr.bin/diff3/diff3.c | 5 +++--
 1 file 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);