Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2015-01-23 08:08:35 -0500
committerHenrik Rentz-Reichert2015-01-23 08:08:35 -0500
commitc13e3da683bf2839e8482abf54b3a793d0752c6f (patch)
tree0c998e9808eb7ce8d70c672e46294c6d45cc3242
parente93d32c2ec2ca651a4b2f641767fb489bd6e1bd6 (diff)
downloadorg.eclipse.etrice-c13e3da683bf2839e8482abf54b3a793d0752c6f.tar.gz
org.eclipse.etrice-c13e3da683bf2839e8482abf54b3a793d0752c6f.tar.xz
org.eclipse.etrice-c13e3da683bf2839e8482abf54b3a793d0752c6f.zip
[runtime.c] bug fixes in etMemory_FreeList
* computation whether onject fits in heap was wrong * initial computation of current position in heap was wrong Change-Id: Ife19acf6918e9e39e78d2eb61b97d0689f37d0c4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c
index ac9f5e29e..e97b2b1e7 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c
@@ -45,7 +45,7 @@ static void* etMemory_getHeapMem(etFreeListMemory* self, etUInt16 size) {
etUInt8* obj = NULL;
ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "getHeapListMem")
- if (self->current < ((etUInt8*)self)+self->base.size)
+ if (self->current + size < ((etUInt8*)self) + self->base.size)
{
obj = self->current;
self->current += size;
@@ -96,7 +96,7 @@ static void etMemory_putFreeListMem(etFreeListMemory* self, void* obj, etUInt16
((etFreeListObj*)obj)->next = self->freelists[slot].head;
self->freelists[slot].head = (etFreeListObj*)obj;
#if DEBUG_FREE_LISTS
- ++self->freelists[slot].nobjects;
+ ++(self->freelists[slot].nobjects);
#endif
break;
}
@@ -149,7 +149,7 @@ etMemory* etMemory_FreeList_init(void* heap, etUInt32 size, etUInt16 nslots) {
self->base.free = etMemory_FreeList_free;
self->nslots = nslots;
{
- int used = sizeof(etFreeListMemory)+(self->nslots-1)*sizeof(etFreeListObj);
+ int used = sizeof(etFreeListMemory)+(self->nslots-1)*sizeof(etFreeListInfo);
self->current = ((etUInt8*)self)+MEM_CEIL(used);
}

Back to the top