summaryrefslogtreecommitdiff
path: root/xdiff-interface.c
diff options
context:
space:
mode:
authorBrandon Casey <drafnel@gmail.com>2010-09-09 19:02:46 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-09-10 00:18:29 (GMT)
commit1b6ecbad3511b1aaa65172ef8b520dd3b5141614 (patch)
treef4cd98e11ea7333bc3f555e831166d83cb3f52de /xdiff-interface.c
parentef5644ea6ecec4ee6d6254612af2ed58499ac2fe (diff)
downloadgit-1b6ecbad3511b1aaa65172ef8b520dd3b5141614.zip
git-1b6ecbad3511b1aaa65172ef8b520dd3b5141614.tar.gz
git-1b6ecbad3511b1aaa65172ef8b520dd3b5141614.tar.bz2
xdiff-interface.c: always trim trailing space from xfuncname matches
Generally, trailing space is removed from the string matched by the xfuncname patterns. The exception is when the matched string exceeds the length of the fixed-size buffer that it will be copied in to. But, a string that exceeds the buffer can still contain trailing space in the portion of the string that will be copied into the buffer. So, simplify this code slightly, and just perform the trailing space removal always. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'xdiff-interface.c')
-rw-r--r--xdiff-interface.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/xdiff-interface.c b/xdiff-interface.c
index cd2285d..e1e054e 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -286,9 +286,8 @@ static long ff_regexp(const char *line, long len,
result = pmatch[i].rm_eo - pmatch[i].rm_so;
if (result > buffer_size)
result = buffer_size;
- else
- while (result > 0 && (isspace(line[result - 1])))
- result--;
+ while (result > 0 && (isspace(line[result - 1])))
+ result--;
memcpy(buffer, line, result);
fail:
free(line_buffer);