summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-09-25 10:19:50 -0400
committerEdward Thomson <ethomson@github.com>2016-05-26 13:01:07 -0500
commit0267c34c0cbcdd3b5935d5988d572564dbe5d939 (patch)
tree19eb94789dd54d1157a893a4bcdd3c81c7a0816a
parent4117a2350f87456d76659d9327193bb708187ba9 (diff)
downloadlibgit2-0267c34c0cbcdd3b5935d5988d572564dbe5d939.tar.gz
patch application: drop unnecessary `patch_image_init`
-rw-r--r--src/apply.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/apply.c b/src/apply.c
index a453d3dbb..a9b493519 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -38,11 +38,7 @@ static void patch_line_init(
out->content_offset = in_offset;
}
-static unsigned int patch_image_init(patch_image *out)
-{
- memset(out, 0x0, sizeof(patch_image));
- return 0;
-}
+#define PATCH_IMAGE_INIT { {0} }
static int patch_image_init_fromstr(
patch_image *out, const char *in, size_t in_len)
@@ -165,14 +161,10 @@ static int apply_hunk(
git_patch *patch,
git_patch_hunk *hunk)
{
- patch_image preimage, postimage;
+ patch_image preimage = PATCH_IMAGE_INIT, postimage = PATCH_IMAGE_INIT;
size_t line_num, i;
int error = 0;
- if ((error = patch_image_init(&preimage)) < 0 ||
- (error = patch_image_init(&postimage)) < 0)
- goto done;
-
for (i = 0; i < hunk->line_count; i++) {
size_t linenum = hunk->line_start + i;
git_diff_line *line = git_array_get(patch->lines, linenum);