From: Nicholas Nethercote Date: Sun, 13 Mar 2005 18:33:02 +0000 (+0000) Subject: Get rid of VG_(malloc_aligned)(), and make VG_(arena_malloc_aligned)() local X-Git-Tag: svn/VALGRIND_3_0_0~975 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3addbd95308c907ef1429286ee92ec746cd21341;p=thirdparty%2Fvalgrind.git Get rid of VG_(malloc_aligned)(), and make VG_(arena_malloc_aligned)() local to vg_malloc2.c -- the core and tools never do allocations with alignments different to the default alignment. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3343 --- diff --git a/coregrind/core.h b/coregrind/core.h index 1951565079..5ccf029134 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -386,8 +386,6 @@ extern void VG_(arena_free) ( ArenaId arena, void* ptr ); extern void* VG_(arena_calloc) ( ArenaId arena, SizeT nmemb, SizeT bytes_per_memb ); extern void* VG_(arena_realloc) ( ArenaId arena, void* ptr, SizeT size ); -extern void* VG_(arena_malloc_aligned) ( ArenaId aid, SizeT req_alignB, - SizeT req_pszB ); extern SizeT VG_(arena_payload_szB) ( ArenaId aid, void* payload ); diff --git a/coregrind/vg_malloc2.c b/coregrind/vg_malloc2.c index 75f5472e66..31b4db385d 100644 --- a/coregrind/vg_malloc2.c +++ b/coregrind/vg_malloc2.c @@ -1140,7 +1140,8 @@ void VG_(arena_free) ( ArenaId aid, void* ptr ) . . . . . . . */ -void* VG_(arena_malloc_aligned) ( ArenaId aid, SizeT req_alignB, SizeT req_pszB ) +static +void* arena_malloc_aligned ( ArenaId aid, SizeT req_alignB, SizeT req_pszB ) { SizeT base_pszB_req, base_pszB_act, frag_bszB; Block *base_b, *align_b; @@ -1160,9 +1161,9 @@ void* VG_(arena_malloc_aligned) ( ArenaId aid, SizeT req_alignB, SizeT req_pszB if (req_alignB < VG_MIN_MALLOC_SZB || req_alignB > 1048576 || VG_(log2)( VG_(clo_alignment) ) == -1 /* not a power of 2 */) { - VG_(printf)("VG_(arena_malloc_aligned)(%p, %d, %d)\nbad alignment", + VG_(printf)("arena_malloc_aligned(%p, %d, %d)\nbad alignment", a, req_alignB, req_pszB ); - VG_(core_panic)("VG_(arena_malloc_aligned)"); + VG_(core_panic)("arena_malloc_aligned"); /*NOTREACHED*/ } // Paranoid @@ -1335,20 +1336,14 @@ void* VG_(realloc) ( void* ptr, SizeT size ) return VG_(arena_realloc) ( VG_AR_TOOL, ptr, size ); } -void* VG_(malloc_aligned) ( SizeT req_alignB, SizeT req_pszB ) -{ - return VG_(arena_malloc_aligned) ( VG_AR_TOOL, req_alignB, req_pszB ); -} - - void* VG_(cli_malloc) ( SizeT align, SizeT nbytes ) { - // 'align' should be valid by now. VG_(arena_malloc_aligned)() will + // 'align' should be valid by now. arena_malloc_aligned() will // abort if it's not. if (VG_MIN_MALLOC_SZB == align) - return VG_(arena_malloc) ( VG_AR_CLIENT, nbytes ); + return VG_(arena_malloc) ( VG_AR_CLIENT, nbytes ); else - return VG_(arena_malloc_aligned) ( VG_AR_CLIENT, align, nbytes ); + return arena_malloc_aligned ( VG_AR_CLIENT, align, nbytes ); } void VG_(cli_free) ( void* p ) diff --git a/include/tool.h.base b/include/tool.h.base index fa11571d6c..871b2ca25b 100644 --- a/include/tool.h.base +++ b/include/tool.h.base @@ -337,7 +337,6 @@ extern void* VG_(malloc) ( SizeT nbytes ); extern void VG_(free) ( void* p ); extern void* VG_(calloc) ( SizeT n, SizeT bytes_per_elem ); extern void* VG_(realloc) ( void* p, SizeT size ); -extern void* VG_(malloc_aligned) ( SizeT align_bytes, SizeT nbytes ); /* terminate everything */ extern void VG_(exit)( Int status )