From 7a9f7d1fbc9b72dc43296f7de8b5ab64536938b1 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 28 Jun 2014 22:47:40 -0500 Subject: Use dlist_terminate() in patch. --- toys/posix/patch.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'toys/posix/patch.c') 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); } -- cgit v1.2.3