Commit 0267c34c0cbcdd3b5935d5988d572564dbe5d939

Edward Thomson 2015-09-25T10:19:50

patch application: drop unnecessary `patch_image_init`

diff --git a/src/apply.c b/src/apply.c
index a453d3d..a9b4935 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);