summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/collection.c5
-rw-r--r--common/collection.h2
2 files changed, 4 insertions, 3 deletions
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; i<col->capacity; 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)
diff --git a/common/collection.h b/common/collection.h
index a91a465..47b9b7f 100644
--- a/common/collection.h
+++ b/common/collection.h
@@ -29,7 +29,7 @@ struct collection {
void collection_init(struct collection *col);
void collection_add(struct collection *col, void *element);
-void collection_remove(struct collection *col, void *element);
+int collection_remove(struct collection *col, void *element);
int collection_count(struct collection *col);
void collection_free(struct collection *col);