@matheusbsbs / matheus-bagliano / commits / 1b6ecbad35
Fork 0

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>

Brandon Casey committed Sep 9, 2010 at 14:02 UTC 1b6ecbad3511b1aaa65172ef8b520dd3b5141614
1 file changed +2 -3
xdiff-interface.c
+2 -3
@@ -286,9 +286,8 @@ static long ff_regexp(const char *line, long len,
286 result = pmatch[i].rm_eo - pmatch[i].rm_so;
287 if (result > buffer_size)
288 result = buffer_size;
289 - else
290 - while (result > 0 && (isspace(line[result - 1])))
291 - result--;
289 + while (result > 0 && (isspace(line[result - 1])))
290 + result--;
291 memcpy(buffer, line, result);
292 fail:
293 free(line_buffer);