summaryrefslogtreecommitdiff
path: root/src/common/ers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/ers.c')
-rw-r--r--src/common/ers.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/common/ers.c b/src/common/ers.c
index 8970fefc2..3e1cdc25b 100644
--- a/src/common/ers.c
+++ b/src/common/ers.c
@@ -149,7 +149,8 @@ static struct ers_instance_t *InstanceList = NULL;
/**
* @param Options the options from the instance seeking a cache, we use it to give it a cache with matching configuration
**/
-static ers_cache_t *ers_find_cache(unsigned int size, enum ERSOptions Options) {
+static ers_cache_t *ers_find_cache(unsigned int size, enum ERSOptions Options)
+{
ers_cache_t *cache;
for (cache = CacheList; cache; cache = cache->Next)
@@ -187,6 +188,7 @@ static void ers_free_cache(ers_cache_t *cache, bool remove)
{
unsigned int i;
+ nullpo_retv(cache);
for (i = 0; i < cache->Used; i++)
aFree(cache->Blocks[i]);
@@ -307,7 +309,8 @@ static void ers_obj_destroy(ERS *self)
aFree(instance);
}
-void ers_cache_size(ERS *self, unsigned int new_size) {
+void ers_cache_size(ERS *self, unsigned int new_size)
+{
struct ers_instance_t *instance = (struct ers_instance_t *)self;
nullpo_retv(instance);
@@ -319,10 +322,11 @@ void ers_cache_size(ERS *self, unsigned int new_size) {
instance->Cache->ChunkSize = new_size;
}
-
ERS *ers_new(uint32 size, char *name, enum ERSOptions options)
{
struct ers_instance_t *instance;
+
+ nullpo_retr(NULL, name);
CREATE(instance,struct ers_instance_t, 1);
size += sizeof(struct ers_list);
@@ -359,7 +363,8 @@ ERS *ers_new(uint32 size, char *name, enum ERSOptions options)
return &instance->VTable;
}
-void ers_report(void) {
+void ers_report(void)
+{
ers_cache_t *cache;
unsigned int cache_c = 0, blocks_u = 0, blocks_a = 0, memory_b = 0, memory_t = 0;
#ifdef DEBUG
@@ -403,7 +408,8 @@ void ers_report(void) {
/**
* Call on shutdown to clear remaining entries
**/
-void ers_final(void) {
+void ers_final(void)
+{
struct ers_instance_t *instance = InstanceList, *next;
while( instance ) {