aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/patch.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix/patch.c')
-rw-r--r--toys/posix/patch.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/toys/posix/patch.c b/toys/posix/patch.c
index bb443484..7fb6add3 100644
--- a/toys/posix/patch.c
+++ b/toys/posix/patch.c
@@ -204,18 +204,12 @@ static int apply_one_hunk(void)
if (PATCH_DEBUG) fprintf(stderr, "NOT: %s\n", plist->data);
TT.state = 3;
- check = llist_pop(&buf);
- check->prev->next = buf;
- buf->prev = check->prev;
- do_line(check);
+ do_line(check = dlist_pop(&buf));
plist = TT.current_hunk;
// If we've reached the end of the buffer without confirming a
// match, read more lines.
- if (check==buf) {
- buf = 0;
- break;
- }
+ if (!buf) break;
check = buf;
} else {
if (PATCH_DEBUG) fprintf(stderr, "MAYBE: %s\n", plist->data);