comparison toys/patch.c @ 624:1e8b9acdafeb

Genericize llist code a bit: rename llist_free() to llist_traverse(), and no longer accept NULL as a synonym for free.
author Rob Landley <rob@landley.net>
date Sun, 15 Jul 2012 17:22:04 -0500
parents b2194045c40e
children
comparison
equal deleted inserted replaced
623:f51beec92738 624:1e8b9acdafeb
106 106
107 // If we got to this point, we've seeked to the end. Discard changes to 107 // If we got to this point, we've seeked to the end. Discard changes to
108 // this file and advance to next file. 108 // this file and advance to next file.
109 109
110 TT.state = 2; 110 TT.state = 2;
111 llist_free(TT.current_hunk, do_line); 111 llist_traverse(TT.current_hunk, do_line);
112 TT.current_hunk = NULL; 112 TT.current_hunk = NULL;
113 delete_tempfile(TT.filein, TT.fileout, &TT.tempname); 113 delete_tempfile(TT.filein, TT.fileout, &TT.tempname);
114 TT.state = 0; 114 TT.state = 0;
115 } 115 }
116 116
219 } 219 }
220 } 220 }
221 out: 221 out:
222 // We have a match. Emit changed data. 222 // We have a match. Emit changed data.
223 TT.state = "-+"[reverse]; 223 TT.state = "-+"[reverse];
224 llist_free(TT.current_hunk, do_line); 224 llist_traverse(TT.current_hunk, do_line);
225 TT.current_hunk = NULL; 225 TT.current_hunk = NULL;
226 TT.state = 1; 226 TT.state = 1;
227 done: 227 done:
228 if (buf) { 228 if (buf) {
229 buf->prev->next = NULL; 229 buf->prev->next = NULL;
230 llist_free(buf, do_line); 230 llist_traverse(buf, do_line);
231 } 231 }
232 232
233 return TT.state; 233 return TT.state;
234 } 234 }
235 235