Bladeren bron

minor cosmetic fixes

Ioannis Koutras 12 jaren geleden
bovenliggende
commit
702afbe006
5 gewijzigde bestanden met toevoegingen van 14 en 8 verwijderingen
  1. 1 1
      include/dmmlib/dmmstats.h
  2. 7 2
      src/CMakeLists.txt
  3. 2 2
      src/initialize.c
  4. 2 1
      src/malloc.c
  5. 2 2
      src/statistics.c

+ 1 - 1
include/dmmlib/dmmstats.h

@@ -51,6 +51,6 @@ size_t get_total_requested_memory(void);
 size_t get_total_allocated_memory(void);
 
 /** Returns the current utilization index. */
-float get_utilization_index(void);
+long double get_utilization_index(void);
 
 #endif /* DMMSTATS_H */

+ 7 - 2
src/CMakeLists.txt

@@ -187,9 +187,13 @@ if(WITH_REALLOC)
     ${CMAKE_SOURCE_DIR}/contrib/memcpy/include
   )
 
-  # memcpy needs the following define flag on 64-bit architectures
+  set_source_files_properties(${CMAKE_SOURCE_DIR}/contrib/memcpy/src/memcpy.c
+    COMPILE_FLAGS "-Wno-conversion")
+
+  # memcpy needs a define flag on 64-bit architectures
   if(CMAKE_SIZEOF_VOID_P EQUAL 8)
-    add_definitions(-DMEMCPY_64BIT)
+    set_source_files_properties(${CMAKE_SOURCE_DIR}/contrib/memcpy/src/memcpy.c
+      COMPILE_FLAGS "-Wno-conversion -DMEMCPY_64BIT")
   endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
 
   set(dmmlib_SRCS
@@ -197,6 +201,7 @@ if(WITH_REALLOC)
     realloc.c
     ${CMAKE_SOURCE_DIR}/contrib/memcpy/src/memcpy.c
   )
+
 endif(WITH_REALLOC)
 
 if(WITH_CALLOC)

+ 2 - 2
src/initialize.c

@@ -27,9 +27,9 @@
 
 /** Global variable storing allocator's settings */
 allocator_t systemallocator =
-    { .rb_head = NULL
+    { .rb_head = {NULL}
 #ifdef WITH_DEBUG
-    , .bb_head = NULL
+    , .bb_head = {NULL}
 #endif /* WITH_DEBUG */
 #ifdef HAVE_LOCKS
     , .creation_mutex = PTHREAD_MUTEX_INITIALIZER

+ 2 - 1
src/malloc.c

@@ -137,7 +137,8 @@ void * malloc(size_t size) {
             if(new_raw_block != NULL) {
                 LOCK_GLOBAL();
                 LOCK_RAW_BLOCK(new_raw_block);
-                SLIST_INSERT_HEAD(&systemallocator.rb_head, new_raw_block, pointers);
+                SLIST_INSERT_HEAD(&systemallocator.rb_head, new_raw_block,
+                        pointers);
                 UNLOCK_GLOBAL();
 
                 encapsulated_rb = (DEFAULT_RB_T *)

+ 2 - 2
src/statistics.c

@@ -86,9 +86,9 @@ size_t get_total_allocated_memory(void) {
     return systemallocator.dmm_stats.total_mem_allocated;
 }
 
-float get_utilization_index(void) {
+long double get_utilization_index(void) {
     if(systemallocator.dmm_stats.total_mem_allocated != 0) {
-        return (float) systemallocator.dmm_stats.total_mem_requested /
+        return (long double) systemallocator.dmm_stats.total_mem_requested /
             systemallocator.dmm_stats.total_mem_allocated;
     } else {
         return 1.0;