Skip to content

Commit a604dde

Browse files
committed
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>
1 parent 6fe5390 commit a604dde

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

builtin/apply.c

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -198,19 +198,24 @@ struct patch {
198198

199199
static void free_patch(struct patch *patch)
200200
{
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;
214219
}
215220
}
216221

@@ -3771,7 +3776,7 @@ static int apply_patch(int fd, const char *filename, int options)
37713776
if (summary)
37723777
summary_patch_list(list);
37733778

3774-
free_patch(list);
3779+
free_patch_list(list);
37753780
strbuf_release(&buf);
37763781
return 0;
37773782
}

0 commit comments

Comments
 (0)