diff options
Diffstat (limited to 'line-range.c')
-rw-r--r-- | line-range.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/line-range.c b/line-range.c index 955a8a9535..60f0e5ada8 100644 --- a/line-range.c +++ b/line-range.c @@ -1,7 +1,6 @@ #include "git-compat-util.h" #include "line-range.h" #include "xdiff-interface.h" -#include "strbuf.h" #include "userdiff.h" /* @@ -135,7 +134,7 @@ static const char *find_funcname_matching_regexp(xdemitconf_t *xecfg, const char { int reg_error; regmatch_t match[1]; - while (1) { + while (*start) { const char *bol, *eol; reg_error = regexec(regexp, start, 1, match, 0); if (reg_error == REG_NOMATCH) @@ -148,8 +147,8 @@ static const char *find_funcname_matching_regexp(xdemitconf_t *xecfg, const char /* determine extent of line matched */ bol = start+match[0].rm_so; eol = start+match[0].rm_eo; - while (bol > start && *bol != '\n') - bol--; + while (bol > start && *--bol != '\n') + ; /* nothing */ if (*bol == '\n') bol++; while (*eol && *eol != '\n') @@ -161,6 +160,7 @@ static const char *find_funcname_matching_regexp(xdemitconf_t *xecfg, const char return bol; start = eol; } + return NULL; } static const char *parse_range_funcname( |