summaryrefslogtreecommitdiff
path: root/src/common/ers.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-05-13 18:17:52 +0200
committerHaru <haru@dotalux.com>2014-05-13 18:17:52 +0200
commit5d67f33135a5305665f78307e03fa9aee7aa544b (patch)
tree831248cdf9994ccb9e44751d0d68220631c6d4dd /src/common/ers.c
parentc03094034f5338016221775bce4b39a0e9b75ee6 (diff)
downloadhercules-5d67f33135a5305665f78307e03fa9aee7aa544b.tar.gz
hercules-5d67f33135a5305665f78307e03fa9aee7aa544b.tar.bz2
hercules-5d67f33135a5305665f78307e03fa9aee7aa544b.tar.xz
hercules-5d67f33135a5305665f78307e03fa9aee7aa544b.zip
Removed trailing whitespace (sources)
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/ers.c')
-rw-r--r--src/common/ers.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/common/ers.c b/src/common/ers.c
index d9895e4f2..39e05a14c 100644
--- a/src/common/ers.c
+++ b/src/common/ers.c
@@ -78,7 +78,7 @@ typedef struct ers_cache
// Memory blocks array
unsigned char **Blocks;
- // Max number of blocks
+ // Max number of blocks
unsigned int Max;
// Free objects count
@@ -190,26 +190,19 @@ static void *ers_obj_alloc_entry(ERS self)
struct ers_instance_t *instance = (struct ers_instance_t *)self;
void *ret;
- if (instance == NULL)
- {
+ if (instance == NULL) {
ShowError("ers_obj_alloc_entry: NULL object, aborting entry freeing.\n");
return NULL;
}
- if (instance->Cache->ReuseList != NULL)
- {
+ if (instance->Cache->ReuseList != NULL) {
ret = (void *)((unsigned char *)instance->Cache->ReuseList + sizeof(struct ers_list));
instance->Cache->ReuseList = instance->Cache->ReuseList->Next;
- }
- else if (instance->Cache->Free > 0)
- {
+ } else if (instance->Cache->Free > 0) {
instance->Cache->Free--;
ret = &instance->Cache->Blocks[instance->Cache->Used - 1][instance->Cache->Free * instance->Cache->ObjectSize + sizeof(struct ers_list)];
- }
- else
- {
- if (instance->Cache->Used == instance->Cache->Max)
- {
+ } else {
+ if (instance->Cache->Used == instance->Cache->Max) {
instance->Cache->Max = (instance->Cache->Max * 4) + 3;
RECREATE(instance->Cache->Blocks, unsigned char *, instance->Cache->Max);
}
@@ -237,13 +230,10 @@ static void ers_obj_free_entry(ERS self, void *entry)
struct ers_instance_t *instance = (struct ers_instance_t *)self;
struct ers_list *reuse = (struct ers_list *)((unsigned char *)entry - sizeof(struct ers_list));
- if (instance == NULL)
- {
+ if (instance == NULL) {
ShowError("ers_obj_free_entry: NULL object, aborting entry freeing.\n");
return;
- }
- else if (entry == NULL)
- {
+ } else if (entry == NULL) {
ShowError("ers_obj_free_entry: NULL entry, nothing to free.\n");
return;
}
@@ -261,11 +251,10 @@ static size_t ers_obj_entry_size(ERS self)
{
struct ers_instance_t *instance = (struct ers_instance_t *)self;
- if (instance == NULL)
- {
+ if (instance == NULL) {
ShowError("ers_obj_entry_size: NULL object, aborting entry freeing.\n");
return 0;
- }
+ }
return instance->Cache->ObjectSize;
}
@@ -274,8 +263,7 @@ static void ers_obj_destroy(ERS self)
{
struct ers_instance_t *instance = (struct ers_instance_t *)self;
- if (instance == NULL)
- {
+ if (instance == NULL) {
ShowError("ers_obj_destroy: NULL object, aborting entry freeing.\n");
return;
}