apply: rename free_patch() to free_patch_list()
As that is the only logical name for a function that walks a list and frees each element on it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Mar 27, 2012 at 15:10 UTC
a604ddef737c79f4df9a943ff316e87b7c8a1de8
1 file changed
+19
-14
builtin/apply.c
+19
-14
@@ -198,19 +198,24 @@ struct patch {
198
199
static void free_patch(struct patch *patch)
200
{
201
- while (patch) {
202
- struct patch *patch_next = patch->next;
203
- struct fragment *fragment = patch->fragments;
204
-
205
- while (fragment) {
206
- struct fragment *fragment_next = fragment->next;
207
- if (fragment->patch != NULL && fragment->free_patch)
208
- free((char *)fragment->patch);
209
- free(fragment);
210
- fragment = fragment_next;
211
- }
212
- free(patch);
213
- patch = patch_next;
201
+ struct fragment *fragment = patch->fragments;
202
+
203
+ while (fragment) {
204
+ struct fragment *fragment_next = fragment->next;
205
+ if (fragment->patch != NULL && fragment->free_patch)
206
+ free((char *)fragment->patch);
207
+ free(fragment);
208
+ fragment = fragment_next;
209
+ }
210
+ free(patch);
211
+}
212
+
213
+static void free_patch_list(struct patch *list)
214
+{
215
+ while (list) {
216
+ struct patch *next = list->next;
217
+ free_patch(list);
218
+ list = next;
219
}
220
}
221
@@ -3771,7 +3776,7 @@ static int apply_patch(int fd, const char *filename, int options)
3776
if (summary)
3777
summary_patch_list(list);
3778
3774
- free_patch(list);
3779
+ free_patch_list(list);
3780
strbuf_release(&buf);
3781
return 0;
3782
}