Mercurial > hg > toybox
comparison toys/posix/patch.c @ 1060:c2663b7eca78 draft
Adjust patch to use dlist_pop()
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 09 Sep 2013 05:26:52 -0500 |
parents | 98c396477e0b |
children | ccf4193167c3 |
comparison
equal
deleted
inserted
replaced
1059:ef72a16f4b3a | 1060:c2663b7eca78 |
---|---|
202 // recheck remaining buffered data for a new match. | 202 // recheck remaining buffered data for a new match. |
203 | 203 |
204 if (PATCH_DEBUG) fprintf(stderr, "NOT: %s\n", plist->data); | 204 if (PATCH_DEBUG) fprintf(stderr, "NOT: %s\n", plist->data); |
205 | 205 |
206 TT.state = 3; | 206 TT.state = 3; |
207 check = llist_pop(&buf); | 207 do_line(check = dlist_pop(&buf)); |
208 check->prev->next = buf; | |
209 buf->prev = check->prev; | |
210 do_line(check); | |
211 plist = TT.current_hunk; | 208 plist = TT.current_hunk; |
212 | 209 |
213 // If we've reached the end of the buffer without confirming a | 210 // If we've reached the end of the buffer without confirming a |
214 // match, read more lines. | 211 // match, read more lines. |
215 if (check==buf) { | 212 if (!buf) break; |
216 buf = 0; | |
217 break; | |
218 } | |
219 check = buf; | 213 check = buf; |
220 } else { | 214 } else { |
221 if (PATCH_DEBUG) fprintf(stderr, "MAYBE: %s\n", plist->data); | 215 if (PATCH_DEBUG) fprintf(stderr, "MAYBE: %s\n", plist->data); |
222 // This line matches. Advance plist, detect successful match. | 216 // This line matches. Advance plist, detect successful match. |
223 plist = plist->next; | 217 plist = plist->next; |