summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d599e04)
raw | patch | inline | side by side (parent: d599e04)
author | Alexey Mahotkin <squadette@gmail.com> | |
Wed, 28 Apr 2010 11:29:06 +0000 (15:29 +0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 1 May 2010 18:11:11 +0000 (11:11 -0700) |
memset() is heavily optimized, and resulting assembler code
is about 150 lines less for that file.
Signed-off-by: Alexey Mahotkin <squadette@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
is about 150 lines less for that file.
Signed-off-by: Alexey Mahotkin <squadette@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
xdiff/xmerge.c | patch | blob | history |
diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c
index 16dd9acd37b431f1e439d9ab051fe2436c54b45c..6d6fc1bc5e01be7305ec5101f43645a1dce69bd3 100644 (file)
--- a/xdiff/xmerge.c
+++ b/xdiff/xmerge.c
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;
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);
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);
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';
}
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);