diff --git a/src/ObjectStore.c b/src/ObjectStore.c index 9cf72d8..71074f2 100644 --- a/src/ObjectStore.c +++ b/src/ObjectStore.c @@ -23,7 +23,7 @@ struct object_store { ObjectID reusable_ids[MAX_OBJ_COUNT]; }; -bool object_exists(ObjectStore *os, void *object); +bool object_exists(ObjectStore *os, const void *object); ObjectStore *create_object_store() { ObjectStore *os = (ObjectStore *)malloc(sizeof(ObjectStore)); @@ -107,6 +107,7 @@ void remove_object_from_store(ObjectStore *os, ObjectID *id_ptr) { // Figure out how much we need to decrement the count. Since, a lot of // objects may have been removed, the count needs to equal the last active // object. + // cppcheck-suppress unsignedPositive for (size_t i = id - 1; i >= 0; --i) { if (os->object_ptrs[i]) { new_count = i + 1; @@ -175,7 +176,7 @@ void destroy_object_store(ObjectStore **os) { *os = NULL; } -bool object_exists(ObjectStore *os, void *object) { +bool object_exists(ObjectStore *os, const void *object) { // This is a crude implementation for checking that an object has already // been added. // TODO (Abdelrahman): Figure out if there is a better way of doing this