]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Rename VG_(malloc_usable_size) to VG_(cli_malloc_usable_size)
authorFlorian Krohm <florian@eich-krohm.de>
Thu, 11 Sep 2014 20:15:23 +0000 (20:15 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Thu, 11 Sep 2014 20:15:23 +0000 (20:15 +0000)
because it operates on the CLIENT arena. Given that VG_(malloc)
operates on the CORE arena, it was unexpected for VG_(mallos_usable_size)
to use a different arena.
Move function definition to the proper place (next to VG_(cli_malloc))
and fix call sites.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14516

coregrind/m_mallocfree.c
coregrind/m_replacemalloc/replacemalloc_core.c
exp-dhat/dh_main.c
include/pub_tool_mallocfree.h
include/pub_tool_replacemalloc.h
massif/ms_main.c

index 043069b36d1a0b59da102cee346e264faa4537ff..93b7a2a4a4939888bad2ea7977cc6a7e177d5dfe 100644 (file)
@@ -2599,12 +2599,6 @@ HChar* VG_(strdup) ( const HChar* cc, const HChar* s )
    return VG_(arena_strdup) ( VG_AR_CORE, cc, s ); 
 }
 
-// Useful for querying user blocks.           
-SizeT VG_(malloc_usable_size) ( void* p )                    
-{                                                            
-   return VG_(arena_malloc_usable_size)(VG_AR_CLIENT, p);
-}                                                            
-  
 void* VG_(perm_malloc) ( SizeT size, Int align  )
 {
    return VG_(arena_perm_malloc) ( VG_AR_CORE, size, align );
index aa9b46a366f3643a57e716031c8aeaa2dbc4d03a..9bf40dbe4f73f8151071cdf6335c7c937666bdb1 100644 (file)
@@ -101,6 +101,12 @@ void VG_(cli_free) ( void* p )
    VG_(arena_free) ( VG_AR_CLIENT, p );                          
 }
 
+// Useful for querying user blocks.           
+SizeT VG_(cli_malloc_usable_size) ( void* p )                    
+{                                                            
+   return VG_(arena_malloc_usable_size)(VG_AR_CLIENT, p);
+}                                                            
+  
 Bool VG_(addr_is_in_block)( Addr a, Addr start, SizeT size, SizeT rz_szB )
 {
    return ( start - rz_szB <= a  &&  a < start + size + rz_szB );
index 4142a90522605afe745fe198dfce3ae5acfc291a..e18b395f48459116020148390a069c9057b3d6c0 100644 (file)
@@ -466,7 +466,7 @@ void* new_block ( ThreadId tid, void* p, SizeT req_szB, SizeT req_alignB,
          return NULL;
       }
       if (is_zeroed) VG_(memset)(p, 0, req_szB);
-      actual_szB = VG_(malloc_usable_size)(p);
+      actual_szB = VG_(cli_malloc_usable_size)(p);
       tl_assert(actual_szB >= req_szB);
       /* slop_szB = actual_szB - req_szB; */
    } else {
index 7ddb32e72e3dd23d26aee700ea6a09ed6cd2f807..0524162c7ce416ead93d40b8ec6955518bd349fc 100644 (file)
@@ -45,10 +45,6 @@ extern void* VG_(calloc)         ( const HChar* cc, SizeT n, SizeT bytes_per_ele
 extern void*  VG_(realloc)       ( const HChar* cc, void* p, SizeT size );
 extern HChar* VG_(strdup)        ( const HChar* cc, const HChar* s );
 
-// Returns the usable size of a heap-block.  It's the asked-for size plus
-// possibly some more due to rounding up.
-extern SizeT VG_(malloc_usable_size)( void* p );
-
 // TODO: move somewhere else
 // Call here to bomb the system when out of memory (mmap anon fails)
 __attribute__((noreturn))
@@ -60,8 +56,7 @@ extern void VG_(out_of_memory_NORETURN) ( const HChar* who, SizeT szB );
 // on a multiple of align.
 // Use the macro vg_alignof (type) to get a safe alignment for a type.
 // No other function can be used on these permanently allocated blocks.
-// In particular, do *not* call VG_(free) or VG_(malloc_usable_size)
-// or VG_(realloc).
+// In particular, do *not* call VG_(free) or VG_(realloc).
 // Technically, these blocks will be returned from big superblocks
 // only containing such permanently allocated blocks.
 // Note that there is no cc cost centre : all such blocks will be
index bab3b4fb830d369a37b10e5df537b220a772e84d..bc019f5eab8a45df92a99df943c68d50398bfe9f 100644 (file)
  * alloc/freeing. */
 extern void* VG_(cli_malloc) ( SizeT align, SizeT nbytes );
 extern void  VG_(cli_free)   ( void* p );
+// Returns the usable size of a heap-block.  It's the asked-for size plus
+// possibly some more due to rounding up.
+extern SizeT VG_(cli_malloc_usable_size)( void* p );
+
 
 /* If a tool uses deferred freeing (e.g. memcheck to catch accesses to
    freed memory) it can maintain number and total size of queued blocks
index 0770f3dd46522f9067259ca149c41ac5d082267e..9f33546c4e858588f8ea0711d2125138c63d9c83 100644 (file)
@@ -1567,7 +1567,7 @@ void* alloc_and_record_block ( ThreadId tid, SizeT req_szB, SizeT req_alignB,
       return NULL;
    }
    if (is_zeroed) VG_(memset)(p, 0, req_szB);
-   actual_szB = VG_(malloc_usable_size)(p);
+   actual_szB = VG_(cli_malloc_usable_size)(p);
    tl_assert(actual_szB >= req_szB);
    slop_szB = actual_szB - req_szB;
 
@@ -1682,7 +1682,7 @@ void* realloc_block ( ThreadId tid, void* p_old, SizeT new_req_szB )
       }
       VG_(memcpy)(p_new, p_old, old_req_szB + old_slop_szB);
       VG_(cli_free)(p_old);
-      new_actual_szB = VG_(malloc_usable_size)(p_new);
+      new_actual_szB = VG_(cli_malloc_usable_size)(p_new);
       tl_assert(new_actual_szB >= new_req_szB);
       new_slop_szB = new_actual_szB - new_req_szB;
    }