git: 4be7d087c2b5 - main - diff: Use start of change when searching for function

From: Tom Jones <thj_at_FreeBSD.org>
Date: Tue, 01 Mar 2022 13:27:50 UTC
The branch main has been updated by thj:

URL: https://cgit.FreeBSD.org/src/commit/?id=4be7d087c2b566f4910683836be279d55c1a81c6

commit 4be7d087c2b566f4910683836be279d55c1a81c6
Author:     Tom Jones <thj@FreeBSD.org>
AuthorDate: 2022-03-01 13:23:25 +0000
Commit:     Tom Jones <thj@FreeBSD.org>
CommitDate: 2022-03-01 13:27:21 +0000

    diff: Use start of change when searching for function
    
    Use the start of change when searching for a function rather than the
    start of the context. In short functions if this could result in search
    for the function name starting from before the function definition.
    
    PR:             262086
    Reviewed by:    bapt, mckusick, mhorne
    Sponsored by:   Klara Inc.
    Differential Revision:  https://reviews.freebsd.org/D34328
---
 usr.bin/diff/diffreg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
index ae815aa4e01f..4fbdd3c3f50c 100644
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -1462,7 +1462,7 @@ dump_context_vec(FILE *f1, FILE *f2, int flags)
 
 	printf("***************");
 	if (flags & (D_PROTOTYPE | D_MATCHLAST)) {
-		f = match_function(ixold, lowa - 1, f1);
+		f = match_function(ixold, cvp->a - 1, f1);
 		if (f != NULL)
 			printf(" %s", f);
 	}
@@ -1569,7 +1569,7 @@ dump_unified_vec(FILE *f1, FILE *f2, int flags)
 	uni_range(lowc, upd);
 	printf(" @@");
 	if (flags & (D_PROTOTYPE | D_MATCHLAST)) {
-		f = match_function(ixold, lowa - 1, f1);
+		f = match_function(ixold, cvp->a - 1, f1);
 		if (f != NULL)
 			printf(" %s", f);
 	}