Commit Diff


commit - 1bf85b22df5bb9019f291c010d72dcf37ad2e774
commit + cb103d042c6d1e6cb1483ffa71f54577a8564d9a
blob - df87bed092f0a22f4787ade94b10bdac94c80123
blob + 0165b2095d45e86babad19b66b1fd4b5419be669
--- lib/commit_graph.c
+++ lib/commit_graph.c
@@ -490,13 +490,14 @@ struct gather_branch_tips_arg {
 	int ntips;
 };
 
-static void
+static const struct got_error *
 gather_branch_tips(struct got_object_id *id, void *data, void *arg)
 {
 	struct gather_branch_tips_arg *a = arg;
 	memcpy(&a->tips[a->ntips].id, id, sizeof(*id));
 	a->tips[a->ntips].node = data;
 	a->ntips++;
+	return NULL;
 }
 
 static const struct got_error *
@@ -531,8 +532,10 @@ fetch_commits_from_open_branches(int *ncommits,
 	}
 	arg.ntips = 0; /* reset; gather_branch_tips() will increment */
 	arg.tips = graph->tips;
-	got_object_idset_for_each(graph->open_branches,
+	err = got_object_idset_for_each(graph->open_branches,
 	    gather_branch_tips, &arg);
+	if (err)
+		return err;
 
 	for (i = 0; i < arg.ntips; i++) {
 		struct got_object_id *commit_id;
@@ -588,11 +591,12 @@ got_commit_graph_fetch_commits(struct got_commit_graph
 	return NULL;
 }
 
-static void
+static const struct got_error *
 free_node_iter(struct got_object_id *id, void *data, void *arg)
 {
 	struct got_commit_graph_node *node = data;
 	free_node(node);
+	return NULL;
 }
 
 void
blob - aad920423825b71bc7a553e2af26982b93bed2f0
blob + 6ae68d96bfa9ec1cf42dbe4e49500d0ea2c61a89
--- lib/got_lib_object_idset.h
+++ lib/got_lib_object_idset.h
@@ -26,6 +26,7 @@ const struct got_error *got_object_idset_remove(void *
     struct got_object_idset *, struct got_object_id *);
 int got_object_idset_contains(struct got_object_idset *,
     struct got_object_id *);
-void got_object_idset_for_each(struct got_object_idset *,
-    void (*cb)(struct got_object_id *, void *, void *), void *);
+const struct got_error *got_object_idset_for_each(struct got_object_idset *,
+    const struct got_error *(*cb)(struct got_object_id *, void *, void *),
+    void *);
 int got_object_idset_num_elements(struct got_object_idset *);
blob - 1433b270d9cff4da6cfc70cea5a3dd0995e0663c
blob + 3325c9fb156df0f75d84e0b7075b5827a4cf25cc
--- lib/object_cache.c
+++ lib/object_cache.c
@@ -149,7 +149,8 @@ print_cache_stats(struct got_object_cache *cache, cons
 	    cache->cache_miss, cache->cache_evict);
 }
 
-void check_refcount(struct got_object_id *id, void *data, void *arg)
+const struct got_error *
+check_refcount(struct got_object_id *id, void *data, void *arg)
 {
 	struct got_object_cache *cache = arg;
 	struct got_object_cache_entry *ce = data;
@@ -159,7 +160,7 @@ void check_refcount(struct got_object_id *id, void *da
 	char *id_str;
 
 	if (got_object_id_str(&id_str, id) != NULL)
-		return;
+		return NULL;
 
 	switch (cache->type) {
 	case GOT_OBJECT_CACHE_TYPE_OBJ:
@@ -185,6 +186,7 @@ void check_refcount(struct got_object_id *id, void *da
 		break;
 	}
 	free(id_str);
+	return NULL;
 }
 #endif
 
blob - 8b2ebfeda7e75be4171854300d11ff17e3ede40c
blob + aef9d21f24fc5cdc46a1afbbc64a048002b064c0
--- lib/object_idset.c
+++ lib/object_idset.c
@@ -172,13 +172,20 @@ got_object_idset_contains(struct got_object_idset *set
 	return entry ? 1 : 0;
 }
 
-void got_object_idset_for_each(struct got_object_idset *set,
-    void (*cb)(struct got_object_id *, void *, void *), void *arg)
+const struct got_error *
+got_object_idset_for_each(struct got_object_idset *set,
+    const struct got_error *(*cb)(struct got_object_id *, void *, void *),
+    void *arg)
 {
+	const struct got_error *err;
 	struct got_object_idset_element *entry;
 
-	RB_FOREACH(entry, got_object_idset_tree, &set->entries)
-		(*cb)(&entry->id, entry->data, arg);
+	RB_FOREACH(entry, got_object_idset_tree, &set->entries) {
+		err = (*cb)(&entry->id, entry->data, arg);
+		if (err)
+			return err;
+	}
+	return NULL;
 }
 
 int
blob - a3971bd5c547500d7cbab66beb3118d1d59f4169
blob + 0925d7645e5fec13d2f891b23f5254173e892ad0
--- regress/idset/idset_test.c
+++ regress/idset/idset_test.c
@@ -55,12 +55,13 @@ static const char *id_str3 = "ffffffffffffffffffffffff
 static struct got_object_id id1, id2, id3;
 static const char *data1 = "data1", *data2 = "data2", *data3 = "data3";
 
-static void
+static const struct got_error *
 idset_cb(struct got_object_id *id, void *data, void *arg) {
 	if ((got_object_id_cmp(id, &id1) == 0 && data == (void *)data1) ||
 	    (got_object_id_cmp(id, &id3) == 0 && data == (void *)data3))
-		return;
+		return NULL;
 	abort();
+	return NULL; /* not reached */
 }
 
 static int