Commit df8cd9c6cd301882ae057c712e2aee94a4b0b195

Stefan Sperling 2020-01-05T00:11:11

small simplification in got_commit_graph_iter_next()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/lib/commit_graph.c b/lib/commit_graph.c
index d776a3f..d2d7bd8 100644
--- a/lib/commit_graph.c
+++ b/lib/commit_graph.c
@@ -513,12 +513,12 @@ got_commit_graph_iter_next(struct got_object_id **id,
 
 	*id = NULL;
 
-	if (TAILQ_EMPTY(&graph->iter_list)) {
+	node = TAILQ_FIRST(&graph->iter_list);
+	if (node == NULL) {
 		/* We are done iterating, or iteration was not started. */
 		return got_error(GOT_ERR_ITER_COMPLETED);
 	}
 
-	node = TAILQ_FIRST(&graph->iter_list);
 	while (TAILQ_NEXT(node, entry) == NULL &&
 	    got_object_idset_num_elements(graph->open_branches) > 0) {
 		err = fetch_commits_from_open_branches(graph, repo,