diff options
Diffstat (limited to 'xdiff')
-rw-r--r-- | xdiff/xmerge.c | 17 | ||||
-rw-r--r-- | xdiff/xutils.c | 4 |
2 files changed, 11 insertions, 10 deletions
diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c index 16dd9acd37..6d6fc1bc5e 100644 --- a/xdiff/xmerge.c +++ b/xdiff/xmerge.c @@ -152,7 +152,6 @@ static int fill_conflict_hunk(xdfenv_t *xe1, const char *name1, int marker1_size = (name1 ? strlen(name1) + 1 : 0); int marker2_size = (name2 ? strlen(name2) + 1 : 0); int marker3_size = (name3 ? strlen(name3) + 1 : 0); - int j; if (marker_size <= 0) marker_size = DEFAULT_CONFLICT_MARKER_SIZE; @@ -164,8 +163,8 @@ static int fill_conflict_hunk(xdfenv_t *xe1, const char *name1, if (!dest) { size += marker_size + 1 + marker1_size; } else { - for (j = 0; j < marker_size; j++) - dest[size++] = '<'; + memset(dest + size, '<', marker_size); + size += marker_size; if (marker1_size) { dest[size] = ' '; memcpy(dest + size + 1, name1, marker1_size - 1); @@ -183,8 +182,8 @@ static int fill_conflict_hunk(xdfenv_t *xe1, const char *name1, if (!dest) { size += marker_size + 1 + marker3_size; } else { - for (j = 0; j < marker_size; j++) - dest[size++] = '|'; + memset(dest + size, '|', marker_size); + size += marker_size; if (marker3_size) { dest[size] = ' '; memcpy(dest + size + 1, name3, marker3_size - 1); @@ -199,8 +198,8 @@ static int fill_conflict_hunk(xdfenv_t *xe1, const char *name1, if (!dest) { size += marker_size + 1; } else { - for (j = 0; j < marker_size; j++) - dest[size++] = '='; + memset(dest + size, '=', marker_size); + size += marker_size; dest[size++] = '\n'; } @@ -210,8 +209,8 @@ static int fill_conflict_hunk(xdfenv_t *xe1, const char *name1, if (!dest) { size += marker_size + 1 + marker2_size; } else { - for (j = 0; j < marker_size; j++) - dest[size++] = '>'; + memset(dest + size, '>', marker_size); + size += marker_size; if (marker2_size) { dest[size] = ' '; memcpy(dest + size + 1, name2, marker2_size - 1); diff --git a/xdiff/xutils.c b/xdiff/xutils.c index bc12f29895..22f9bd692c 100644 --- a/xdiff/xutils.c +++ b/xdiff/xutils.c @@ -190,8 +190,10 @@ int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags) { int i1, i2; + if (s1 == s2 && !memcmp(l1, l2, s1)) + return 1; if (!(flags & XDF_WHITESPACE_FLAGS)) - return s1 == s2 && !memcmp(l1, l2, s1); + return 0; i1 = 0; i2 = 0; |