commit e7c810ea16f3db987ef7ccad3a5c333e32a403a9 from: Stefan Sperling date: Fri Jun 22 07:33:08 2018 UTC allow got_object_idset_remove() to retreive data pointer commit - 4a9bc5ca092ba83ebbcf335d7f386a5145cadec0 commit + e7c810ea16f3db987ef7ccad3a5c333e32a403a9 blob - 958b66ec82b4dd7e18be4a27f9d081e78e7b6484 blob + 4023b5de72d091b968bdf6942e5153a6055d06f2 --- lib/commit_graph.c +++ lib/commit_graph.c @@ -230,7 +230,7 @@ advance_open_branches(struct got_commit_graph *graph, const struct got_error *err; struct got_object_qid *qid; - err = got_object_idset_remove(graph->open_branches, commit_id); + err = got_object_idset_remove(NULL, graph->open_branches, commit_id); if (err && err->code != GOT_ERR_NO_OBJ) return err; blob - f5c7fb0f00c0573570366492dace80e6a2640ea1 blob + 7d98296142abd2f7a34aef5776b35c41a97a36d0 --- lib/got_lib_object_idset.h +++ lib/got_lib_object_idset.h @@ -22,8 +22,8 @@ void got_object_idset_free(struct got_object_idset *); const struct got_error *got_object_idset_add(void **, struct got_object_idset *, struct got_object_id *, void *); void *got_object_idset_get(struct got_object_idset *, struct got_object_id *); -const struct got_error *got_object_idset_remove(struct got_object_idset *, - struct got_object_id *); +const struct got_error *got_object_idset_remove(void **, + struct got_object_idset *, struct got_object_id *); const struct got_error *got_object_idset_remove_random(void **, struct got_object_idset *); int got_object_idset_contains(struct got_object_idset *, blob - 38f091d185260bc335764196671f96e7e6926728 blob + cce68c193f06726365ec70d03d254c03f16f8c9a --- lib/object_idset.c +++ lib/object_idset.c @@ -161,7 +161,7 @@ got_object_idset_get(struct got_object_idset *set, str } const struct got_error * -got_object_idset_remove(struct got_object_idset *set, +got_object_idset_remove(void **data, struct got_object_idset *set, struct got_object_id *id) { struct got_object_idset_element *entry, *tmp; @@ -173,6 +173,8 @@ got_object_idset_remove(struct got_object_idset *set, TAILQ_FOREACH_SAFE(entry, &set->entries[i], entry, tmp) { if (got_object_id_cmp(&entry->id, id) == 0) { TAILQ_REMOVE(&set->entries[i], entry, entry); + if (data) + *data = entry->data; free(entry); set->nelem--; return NULL;