From 8f79bd9b85716c495c2741ac25db37e8d71f22f7 Mon Sep 17 00:00:00 2001 From: Tom Jones Date: Fri, 18 Feb 2022 15:07:52 +0000 Subject: diff: Detect Objective-C methods When searching back for function definitions, consider lines starting with '+' and '-', this allows us to pick up Objective-C methods as well as C style function definitions. Reviewed by: bapt Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D34202 --- usr.bin/diff/diffreg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'usr.bin/diff/diffreg.c') diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c index 995843f9e539..ae815aa4e01f 100644 --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -1419,7 +1419,8 @@ match_function(const long *f, int pos, FILE *fp) strlcpy(lastbuf, buf, sizeof(lastbuf)); lastmatchline = pos; return (lastbuf); - } else if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { + } else if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$' + || buf[0] == '-' || buf[0] == '+') { if (begins_with(buf, "private:")) { if (!state) state = " (private)"; -- cgit v1.2.3