aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-06-28 22:47:40 -0500
committerRob Landley <rob@landley.net>2014-06-28 22:47:40 -0500
commit7a9f7d1fbc9b72dc43296f7de8b5ab64536938b1 (patch)
tree61a7e30c5f1dc185f0f6450cf1bef4b8d41061b3 /toys
parentf1a3098fb332ae0db638da408088a7b9d2c0c14b (diff)
downloadtoybox-7a9f7d1fbc9b72dc43296f7de8b5ab64536938b1.tar.gz
Use dlist_terminate() in patch.
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/patch.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/toys/posix/patch.c b/toys/posix/patch.c
index 27828015..45dce1f6 100644
--- a/toys/posix/patch.c
+++ b/toys/posix/patch.c
@@ -93,7 +93,7 @@ static void finish_oldfile(void)
static void fail_hunk(void)
{
if (!TT.current_hunk) return;
- TT.current_hunk->prev->next = 0;
+ dlist_terminate(TT.current_hunk);
fprintf(stderr, "Hunk %d FAILED %ld/%ld.\n",
TT.hunknum, TT.oldline, TT.newline);
@@ -138,8 +138,7 @@ static int apply_one_hunk(void)
lcmp = (toys.optflags & FLAG_l) ? (void *)loosecmp : (void *)strcmp;
- // Break doubly linked list so we can use singly linked traversal function.
- TT.current_hunk->prev->next = NULL;
+ dlist_terminate(TT.current_hunk);
// Match EOF if there aren't as many ending context lines as beginning
for (plist = TT.current_hunk; plist; plist = plist->next) {
@@ -235,7 +234,7 @@ out:
TT.state = 1;
done:
if (buf) {
- buf->prev->next = NULL;
+ dlist_terminate(buf);
llist_traverse(buf, do_line);
}