aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Gustavsson <bgustavsson@gmail.com>2010-03-06 15:30:21 +0100
committerJunio C Hamano <gitster@pobox.com>2010-03-06 23:53:00 -0800
commit9b25949a07933fb9ce7c10bd309ac176dbe2df2e (patch)
tree86499a4542289ed7af30ed7b15bde8f87c3375c2
parente923eaeb901ff056421b9007adcbbce271caa7b6 (diff)
downloadgit-9b25949a07933fb9ce7c10bd309ac176dbe2df2e.tar.gz
git-9b25949a07933fb9ce7c10bd309ac176dbe2df2e.tar.xz
apply: Don't unnecessarily update line lengths in the preimage
In match_fragment(), the line lengths in the preimage are updated just before calling update_pre_post_images(). That is not necessary, since update_pre_post_images() itself will update the line lengths based on the buffer passed to it. Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin-apply.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index 2a1004d02..fc6c7083f 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1905,20 +1905,15 @@ static int match_fragment(struct image *img,
}
/*
- * Ok, the preimage matches with whitespace fuzz. Update it and
- * the common postimage lines to use the same whitespace as the
- * target. imgoff now holds the true length of the target that
- * matches the preimage, and we need to update the line lengths
- * of the preimage to match the target ones.
+ * Ok, the preimage matches with whitespace fuzz.
+ *
+ * imgoff now holds the true length of the target that
+ * matches the preimage. Update the preimage and
+ * the common postimage context lines to use the same
+ * whitespace as the target.
*/
fixed_buf = xmalloc(imgoff);
memcpy(fixed_buf, img->buf + try, imgoff);
- for (i = 0; i < preimage->nr; i++)
- preimage->line[i].len = img->line[try_lno+i].len;
-
- /*
- * Update the preimage buffer and the postimage context lines.
- */
update_pre_post_images(preimage, postimage,
fixed_buf, imgoff, postlen);
return 1;