瀏覽代碼

It is safe to use bool datatypes in Leon3 platform.

Ioannis Koutras 13 年之前
父節點
當前提交
89ce612d97
共有 4 個文件被更改,包括 1 次插入21 次删除
  1. 1 5
      include/dmmlib/heap.h
  2. 0 4
      src/custom_malloc.c
  3. 0 4
      src/initialize_allocator.c
  4. 0 8
      src/sys_alloc.c

+ 1 - 5
include/dmmlib/heap.h

@@ -27,10 +27,10 @@
 
 #include "dmm_config.h"
 
+#include <stdbool.h>
 #ifndef LEON3
 #include <stdint.h>
 #include <stddef.h> /* For size_t support */
-#include <stdbool.h>
 #else
 #include <sys/types.h>
 #endif
@@ -122,11 +122,7 @@ typedef struct heap_s {
 /** The allocator structure of dmmlib. */
 typedef struct allocator_s {
 	heap_t heaps[NUM_HEAPS]; /**< The heaps that the allocator manages. */
-#ifndef LEON3
 	bool initialized; /**< Initialization flag of the allocator. */
-#else
-	char initialized; /**< Initialization flag of the allocator. */
-#endif /* LEON3 */
 	void *border_ptr; /**< Border pointer of the allocator. */
 #ifdef WITH_MEMORY_SPACE_AWARENESS
 	size_t remaining_size; /**< The size of the remaining free space which

+ 0 - 4
src/custom_malloc.c

@@ -46,11 +46,7 @@ void * custom_ahmalloc(allocator_t* allocator, heap_t* heap, size_t size) {
     /* Go to the system allocator if none was given */
     if(allocator == NULL) {
         allocator = &systemallocator;
-#ifndef LEON3
         if(allocator->initialized != true) {
-#else
-        if(allocator->initialized != '1') {
-#endif /* LEON3 */
             initialize_allocator(allocator);
         }
     }

+ 0 - 4
src/initialize_allocator.c

@@ -88,11 +88,7 @@ void initialize_allocator(allocator_t *allocator) {
     allocator->border_ptr = starting_address;
     allocator->remaining_size = size;
 #endif /* WITH_MEMORY_SPACE_AWARENESS */
-#ifndef LEON3
     allocator->initialized = false;
-#else
-    allocator->initialized = '0';
-#endif /* LEON3 */
 
 #ifdef WITH_FIXED_LISTS
 

+ 0 - 8
src/sys_alloc.c

@@ -52,22 +52,14 @@ void *sys_alloc(allocator_t *allocator, heap_t *heap, size_t size) {
     /* Note: border_ptr has already a value in memory space aware allocators,
      * so in this case we have to check also the initialized value.
      */
-#ifndef LEON3
     if(allocator->border_ptr != NULL && allocator->initialized) {
-#else
-    if(allocator->border_ptr != NULL && allocator->initialized == '1') {
-#endif /* LEON3 */
 #endif /* WITH_MEMORY_SPACE_AWARENESS */
         previous_size = get_size(allocator->border_ptr);
         previous_size_availability = get_size_availability(allocator->border_ptr);
     } else {
         previous_size = 0;
         previous_size_availability = 1; /* Occupied and of 0 size */
-#ifndef LEON3
         allocator->initialized = true;
-#else
-        allocator->initialized = '1';
-#endif /* LEON3 */
     }
 
 #ifndef WITH_MEMORY_SPACE_AWARENESS