mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 18:22:16 +00:00
patch application: drop unnecessary patch_image_init
This commit is contained in:
parent
4117a2350f
commit
0267c34c0c
12
src/apply.c
12
src/apply.c
@ -38,11 +38,7 @@ static void patch_line_init(
|
|||||||
out->content_offset = in_offset;
|
out->content_offset = in_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int patch_image_init(patch_image *out)
|
#define PATCH_IMAGE_INIT { {0} }
|
||||||
{
|
|
||||||
memset(out, 0x0, sizeof(patch_image));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int patch_image_init_fromstr(
|
static int patch_image_init_fromstr(
|
||||||
patch_image *out, const char *in, size_t in_len)
|
patch_image *out, const char *in, size_t in_len)
|
||||||
@ -165,14 +161,10 @@ static int apply_hunk(
|
|||||||
git_patch *patch,
|
git_patch *patch,
|
||||||
git_patch_hunk *hunk)
|
git_patch_hunk *hunk)
|
||||||
{
|
{
|
||||||
patch_image preimage, postimage;
|
patch_image preimage = PATCH_IMAGE_INIT, postimage = PATCH_IMAGE_INIT;
|
||||||
size_t line_num, i;
|
size_t line_num, i;
|
||||||
int error = 0;
|
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++) {
|
for (i = 0; i < hunk->line_count; i++) {
|
||||||
size_t linenum = hunk->line_start + i;
|
size_t linenum = hunk->line_start + i;
|
||||||
git_diff_line *line = git_array_get(patch->lines, linenum);
|
git_diff_line *line = git_array_get(patch->lines, linenum);
|
||||||
|
Loading…
Reference in New Issue
Block a user