From e510ab898865fdaf131e9bc9fd6ab6b7c4a94c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 24 Oct 2015 18:21:31 +0200 Subject: use pop_commit() for consuming the first entry of a struct commit_list Instead of open-coding the function pop_commit() just call it. This makes the intent clearer and reduces code size. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- builtin/reflog.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'builtin/reflog.c') diff --git a/builtin/reflog.c b/builtin/reflog.c index c2eb8ff840..fa841b500b 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -216,7 +216,6 @@ static int keep_entry(struct commit **it, unsigned char *sha1) */ static void mark_reachable(struct expire_reflog_policy_cb *cb) { - struct commit *commit; struct commit_list *pending; unsigned long expire_limit = cb->mark_limit; struct commit_list *leftover = NULL; @@ -226,11 +225,8 @@ static void mark_reachable(struct expire_reflog_policy_cb *cb) pending = cb->mark_list; while (pending) { - struct commit_list *entry = pending; struct commit_list *parent; - pending = entry->next; - commit = entry->item; - free(entry); + struct commit *commit = pop_commit(&pending); if (commit->object.flags & REACHABLE) continue; if (parse_commit(commit)) -- cgit v1.2.3