Commit b30dab8f by Patrick Steinhardt

apply: refactor to use a switch statement

parent 001d76e1
...@@ -206,16 +206,20 @@ static int apply_hunk( ...@@ -206,16 +206,20 @@ static int apply_hunk(
goto done; goto done;
} }
if (line->origin == GIT_DIFF_LINE_CONTEXT || switch (line->origin) {
line->origin == GIT_DIFF_LINE_DELETION) { case GIT_DIFF_LINE_CONTEXT:
if ((error = git_vector_insert(&preimage.lines, line)) < 0) if ((error = git_vector_insert(&preimage.lines, line)) < 0 ||
goto done; (error = git_vector_insert(&postimage.lines, line)) < 0)
} goto done;
break;
if (line->origin == GIT_DIFF_LINE_CONTEXT || case GIT_DIFF_LINE_DELETION:
line->origin == GIT_DIFF_LINE_ADDITION) { if ((error = git_vector_insert(&preimage.lines, line)) < 0)
if ((error = git_vector_insert(&postimage.lines, line)) < 0) goto done;
goto done; break;
case GIT_DIFF_LINE_ADDITION:
if ((error = git_vector_insert(&postimage.lines, line)) < 0)
goto done;
break;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment