From a6b542b389d0536d2730c1721164a712ec2f020e Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 22 May 2019 11:32:11 +0200 Subject: Add new usbmuxd_events_subscribe/unsubscribe functions with a context so it can be used in different threads --- common/collection.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'common/collection.c') diff --git a/common/collection.c b/common/collection.c index ccc4016..d120b3e 100644 --- a/common/collection.c +++ b/common/collection.c @@ -57,16 +57,17 @@ void collection_add(struct collection *col, void *element) col->capacity *= 2; } -void collection_remove(struct collection *col, void *element) +int collection_remove(struct collection *col, void *element) { int i; for(i=0; icapacity; i++) { if(col->list[i] == element) { col->list[i] = NULL; - return; + return 0; } } fprintf(stderr, "%s: WARNING: element %p not present in collection %p (cap %d)", __func__, element, col, col->capacity); + return -1; } int collection_count(struct collection *col) -- cgit v1.1-32-gdbae