Skip to content

Commit

Permalink
- fixes so un-proper compilers can handle the code.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17814 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Oct 22, 2013
1 parent 1a10117 commit 61e7453
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions SimulationRuntime/c/util/memory_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ static inline size_t round_up(size_t num, size_t factor)

static inline void pool_expand(size_t len)
{
list *newlist = NULL;
/* Check if we have enough memory already */
if (memory_pools->size - memory_pools->used >= len) {
return;
}
list *newlist = (list*) malloc(sizeof(list));
newlist = (list*) malloc(sizeof(list));
newlist->next = memory_pools;
memory_pools = newlist;
memory_pools->used = 0;
Expand All @@ -100,7 +101,7 @@ static void* pool_malloc(size_t sz)
sz = round_up(sz,8);
pthread_mutex_lock(&memory_pool_mutex);
pool_expand(sz);
res = memory_pools->memory + memory_pools->used;
res = (void*)((char*)memory_pools->memory + memory_pools->used);
memory_pools->used += sz;
pthread_mutex_unlock(&memory_pool_mutex);
memset(res,0,sz);
Expand Down

0 comments on commit 61e7453

Please sign in to comment.