Fix inconsistent types in guardealloc
authorDan HorĂ¡k <dan@danny.cz>
Tue, 14 Oct 2014 14:11:20 +0000 (16:11 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 14 Oct 2014 14:11:20 +0000 (16:11 +0200)
This basically fixes mix of size_t and uintptr_t usages which might be different size.

intern/guardedalloc/MEM_guardedalloc.h
intern/guardedalloc/intern/mallocn.c
intern/guardedalloc/intern/mallocn_guarded_impl.c
intern/guardedalloc/intern/mallocn_intern.h
intern/guardedalloc/intern/mallocn_lockfree_impl.c

index 3b56362e3d67005bec307bf74d44dc7199f2cfc4..f0a69f993854ff56bbcf775ef1951194d438f510 100644 (file)
@@ -165,9 +165,9 @@ extern "C" {
         * Memory usage stats
         * - MEM_get_memory_in_use is all memory
         * - MEM_get_mapped_memory_in_use is a subset of all memory */
-       extern uintptr_t (*MEM_get_memory_in_use)(void);
+       extern size_t (*MEM_get_memory_in_use)(void);
        /** Get mapped memory usage. */
-       extern uintptr_t (*MEM_get_mapped_memory_in_use)(void);
+       extern size_t (*MEM_get_mapped_memory_in_use)(void);
        /** Get amount of memory blocks in use. */
        extern unsigned int (*MEM_get_memory_blocks_in_use)(void);
 
index be0a8aadf84c6c54708500cd8a05e9e71c2e50fc..a379837c55290261f74929d72effab512230a20c 100644 (file)
@@ -53,11 +53,11 @@ void (*MEM_set_error_callback)(void (*func)(const char *)) = MEM_lockfree_set_er
 bool (*MEM_check_memory_integrity)(void) = MEM_lockfree_check_memory_integrity;
 void (*MEM_set_lock_callback)(void (*lock)(void), void (*unlock)(void)) = MEM_lockfree_set_lock_callback;
 void (*MEM_set_memory_debug)(void) = MEM_lockfree_set_memory_debug;
-uintptr_t (*MEM_get_memory_in_use)(void) = MEM_lockfree_get_memory_in_use;
-uintptr_t (*MEM_get_mapped_memory_in_use)(void) = MEM_lockfree_get_mapped_memory_in_use;
+size_t (*MEM_get_memory_in_use)(void) = MEM_lockfree_get_memory_in_use;
+size_t (*MEM_get_mapped_memory_in_use)(void) = MEM_lockfree_get_mapped_memory_in_use;
 unsigned int (*MEM_get_memory_blocks_in_use)(void) = MEM_lockfree_get_memory_blocks_in_use;
 void (*MEM_reset_peak_memory)(void) = MEM_lockfree_reset_peak_memory;
-uintptr_t (*MEM_get_peak_memory)(void) = MEM_lockfree_get_peak_memory;
+size_t (*MEM_get_peak_memory)(void) = MEM_lockfree_get_peak_memory;
 
 #ifndef NDEBUG
 const char *(*MEM_name_ptr)(void *vmemh) = MEM_lockfree_name_ptr;
index 10781a9cc54a662b7cb19586c945a1bca1d4f20f..ecc54882447dfe82d0bb2898e7a4a2de5025a38a 100644 (file)
@@ -1151,9 +1151,9 @@ void MEM_guarded_reset_peak_memory(void)
        mem_unlock_thread();
 }
 
-uintptr_t MEM_guarded_get_memory_in_use(void)
+size_t MEM_guarded_get_memory_in_use(void)
 {
-       uintptr_t _mem_in_use;
+       size_t _mem_in_use;
 
        mem_lock_thread();
        _mem_in_use = mem_in_use;
@@ -1162,9 +1162,9 @@ uintptr_t MEM_guarded_get_memory_in_use(void)
        return _mem_in_use;
 }
 
-uintptr_t MEM_guarded_get_mapped_memory_in_use(void)
+size_t MEM_guarded_get_mapped_memory_in_use(void)
 {
-       uintptr_t _mmap_in_use;
+       size_t _mmap_in_use;
 
        mem_lock_thread();
        _mmap_in_use = mmap_in_use;
index 7da74f7cc4cff6348816d6191097a9223c4a1182..6cab1f01b70e49f8f13d68dfadd25d8d61bb1a27 100644 (file)
@@ -139,11 +139,11 @@ void MEM_lockfree_set_error_callback(void (*func)(const char *));
 bool MEM_lockfree_check_memory_integrity(void);
 void MEM_lockfree_set_lock_callback(void (*lock)(void), void (*unlock)(void));
 void MEM_lockfree_set_memory_debug(void);
-uintptr_t MEM_lockfree_get_memory_in_use(void);
-uintptr_t MEM_lockfree_get_mapped_memory_in_use(void);
+size_t MEM_lockfree_get_memory_in_use(void);
+size_t MEM_lockfree_get_mapped_memory_in_use(void);
 unsigned int MEM_lockfree_get_memory_blocks_in_use(void);
 void MEM_lockfree_reset_peak_memory(void);
-uintptr_t MEM_lockfree_get_peak_memory(void) ATTR_WARN_UNUSED_RESULT;
+size_t MEM_lockfree_get_peak_memory(void) ATTR_WARN_UNUSED_RESULT;
 #ifndef NDEBUG
 const char *MEM_lockfree_name_ptr(void *vmemh);
 #endif
@@ -166,11 +166,11 @@ void MEM_guarded_set_error_callback(void (*func)(const char *));
 bool MEM_guarded_check_memory_integrity(void);
 void MEM_guarded_set_lock_callback(void (*lock)(void), void (*unlock)(void));
 void MEM_guarded_set_memory_debug(void);
-uintptr_t MEM_guarded_get_memory_in_use(void);
-uintptr_t MEM_guarded_get_mapped_memory_in_use(void);
+size_t MEM_guarded_get_memory_in_use(void);
+size_t MEM_guarded_get_mapped_memory_in_use(void);
 unsigned int MEM_guarded_get_memory_blocks_in_use(void);
 void MEM_guarded_reset_peak_memory(void);
-uintptr_t MEM_guarded_get_peak_memory(void) ATTR_WARN_UNUSED_RESULT;
+size_t MEM_guarded_get_peak_memory(void) ATTR_WARN_UNUSED_RESULT;
 #ifndef NDEBUG
 const char *MEM_guarded_name_ptr(void *vmemh);
 #endif
index 2041a1c132a28c35dc95598fa3f140440ffde648..eaa60202f3c01541f535989b58a29dbb0d0d742b 100644 (file)
@@ -452,12 +452,12 @@ void MEM_lockfree_set_memory_debug(void)
        malloc_debug_memset = true;
 }
 
-uintptr_t MEM_lockfree_get_memory_in_use(void)
+size_t MEM_lockfree_get_memory_in_use(void)
 {
        return mem_in_use;
 }
 
-uintptr_t MEM_lockfree_get_mapped_memory_in_use(void)
+size_t MEM_lockfree_get_mapped_memory_in_use(void)
 {
        return mmap_in_use;
 }
@@ -473,7 +473,7 @@ void MEM_lockfree_reset_peak_memory(void)
        peak_mem = 0;
 }
 
-uintptr_t MEM_lockfree_get_peak_memory(void)
+size_t MEM_lockfree_get_peak_memory(void)
 {
        return peak_mem;
 }