]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Remove the alignment arg from VG_(arena_calloc)() and VG_(arena_realloc)(),
authorNicholas Nethercote <njn@valgrind.org>
Sun, 13 Mar 2005 14:56:31 +0000 (14:56 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Sun, 13 Mar 2005 14:56:31 +0000 (14:56 +0000)
because it was always being set to VG_MIN_ALLOC_SZB, and so was just one
more thing to get wrong, as well as exposing VG_MIN_ALLOC_SZB to more places
than necessary.

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

coregrind/amd64-linux/ldt.c
coregrind/core.h
coregrind/demangle/cp-demangle.c
coregrind/demangle/cplus-dem.c
coregrind/demangle/dyn-string.c
coregrind/vg_dwarf.c
coregrind/vg_malloc2.c
coregrind/x86/state.c

index 5b7c4637eea78bd10ec42a14724db8af3f51a82a..60977d65744613caaedfe38f995307492e1db2e5 100644 (file)
@@ -110,8 +110,7 @@ VgLdtEntry* VG_(allocate_LDT_for_thread) ( VgLdtEntry* parent_ldt )
  
    if (parent_ldt == NULL) {
       /* Allocate a new zeroed-out one. */
-      ldt = (VgLdtEntry*)VG_(arena_calloc)(VG_AR_CORE, VG_MIN_MALLOC_SZB, 
-                                           nbytes, 1);
+      ldt = (VgLdtEntry*)VG_(arena_calloc)(VG_AR_CORE, nbytes, 1);
    } else {
      ldt = (VgLdtEntry*)VG_(arena_malloc)(VG_AR_CORE, nbytes);
      for (i = 0; i < VG_M_LDT_ENTRIES; i++)
index b506fca4783240fe15524e3cea259827d756f680..fc0ba65dc18a7bdbe69e4cc641d4b8deb6c7e7f6 100644 (file)
@@ -387,10 +387,9 @@ typedef Int ArenaId;
 
 extern void* VG_(arena_malloc)  ( ArenaId arena, SizeT nbytes );
 extern void  VG_(arena_free)    ( ArenaId arena, void* ptr );
-extern void* VG_(arena_calloc)  ( ArenaId arena, SizeT alignment,
+extern void* VG_(arena_calloc)  ( ArenaId arena, 
                                   SizeT nmemb, SizeT bytes_per_memb );
-extern void* VG_(arena_realloc) ( ArenaId arena, void* ptr, SizeT alignment,
-                                  SizeT size );
+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 );
 
index 4bd37481f9b91578e8488a665ce60790e73069f1..7bd5d4c7032a0a9d5c9d59dc4835e8e61d744a57 100644 (file)
@@ -50,7 +50,7 @@
 
 #define malloc(s)    VG_(arena_malloc) (VG_AR_DEMANGLE, s)
 #define free(p)      VG_(arena_free)   (VG_AR_DEMANGLE, p)
-#define realloc(p,s) VG_(arena_realloc)(VG_AR_DEMANGLE, p, VG_MIN_MALLOC_SZB, s)
+#define realloc(p,s) VG_(arena_realloc)(VG_AR_DEMANGLE, p, s)
 #endif
 
 /* If CP_DEMANGLE_DEBUG is defined, a trace of the grammar evaluation,
index 311b84fb955d69eb17d32da956d9c60e7c21963e..98fd0c3ed01ceba629d474efd06ed16d4e972c32 100644 (file)
@@ -75,8 +75,7 @@ static char *ada_demangle  PARAMS ((const char *, int));
 #define xstrdup(ptr)        VG_(arena_strdup) (VG_AR_DEMANGLE, ptr)
 #define free(ptr)           VG_(arena_free)   (VG_AR_DEMANGLE, ptr)
 #define xmalloc(size)       VG_(arena_malloc) (VG_AR_DEMANGLE, size)
-#define xrealloc(ptr, size) VG_(arena_realloc)(VG_AR_DEMANGLE, ptr, \
-                                               VG_MIN_MALLOC_SZB, size)
+#define xrealloc(ptr, size) VG_(arena_realloc)(VG_AR_DEMANGLE, ptr, size)
 
 #define abort() vg_assert(0)
 #undef strstr
index 96a2f7dba9cab87cba42751b808262b115b67b26..43a70ac486f62a86bb9868f20ce2e871dad59683 100644 (file)
@@ -38,7 +38,7 @@ Boston, MA 02111-1307, USA.  */
 #ifndef STANDALONE
 #define malloc(s)    VG_(arena_malloc) (VG_AR_DEMANGLE, s)
 #define free(p)      VG_(arena_free)   (VG_AR_DEMANGLE, p)
-#define realloc(p,s) VG_(arena_realloc)(VG_AR_DEMANGLE, p, VG_MIN_MALLOC_SZB, s)
+#define realloc(p,s) VG_(arena_realloc)(VG_AR_DEMANGLE, p, s)
 #endif
 
 /* If this file is being compiled for inclusion in the C++ runtime
index de656f3661602f64bce35e2482255f5115d248f4..120cbf79c28e0de10b95115d20655f26917fb071 100644 (file)
@@ -217,9 +217,8 @@ int process_extended_line_op( SegInfo *si, Char*** fnames,
         *fnames = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof (UInt) * 2);
       else
         *fnames = VG_(arena_realloc)(
-                     VG_AR_SYMTAB, *fnames, VG_MIN_MALLOC_SZB,
-                     sizeof(UInt) 
-                        * (state_machine_regs.last_file_entry + 1));
+                     VG_AR_SYMTAB, *fnames,
+                     sizeof(UInt) * (state_machine_regs.last_file_entry + 1));
       (*fnames)[state_machine_regs.last_file_entry] = VG_(addStr) (si,name, -1);
       data += VG_(strlen) ((char *) data) + 1;
       read_leb128 (data, & bytes_read, 0);
@@ -370,7 +369,6 @@ void VG_(read_debuginfo_dwarf2) ( SegInfo* si, UChar* dwarf2, Int dwarf2_sz )
                fnames = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof (UInt) * 2);
              else
                fnames = VG_(arena_realloc)(VG_AR_SYMTAB, fnames,
-                           VG_MIN_MALLOC_SZB,
                            sizeof(UInt) 
                               * (state_machine_regs.last_file_entry + 1));
              data += VG_(strlen) ((Char *) data) + 1;
index 62dfe496b3b693ff95d60d492e8352848e392be7..f0314162aef836dec24f957732d31c135af1b27a 100644 (file)
@@ -1251,8 +1251,7 @@ SizeT VG_(arena_payload_szB) ( ArenaId aid, void* ptr )
 /*--- Services layered on top of malloc/free.              ---*/
 /*------------------------------------------------------------*/
 
-void* VG_(arena_calloc) ( ArenaId aid, SizeT alignB, SizeT nmemb,
-                          SizeT bytes_per_memb )
+void* VG_(arena_calloc) ( ArenaId aid, SizeT nmemb, SizeT bytes_per_memb )
 {
    SizeT  size;
    UChar* p;
@@ -1262,10 +1261,7 @@ void* VG_(arena_calloc) ( ArenaId aid, SizeT alignB, SizeT nmemb,
    size = nmemb * bytes_per_memb;
    vg_assert(size >= nmemb && size >= bytes_per_memb);// check against overflow
 
-   if (alignB == VG_MIN_MALLOC_SZB)
-      p = VG_(arena_malloc) ( aid, size );
-   else
-      p = VG_(arena_malloc_aligned) ( aid, alignB, size );
+   p = VG_(arena_malloc) ( aid, size );
 
    VG_(memset)(p, 0, size);
 
@@ -1277,8 +1273,7 @@ void* VG_(arena_calloc) ( ArenaId aid, SizeT alignB, SizeT nmemb,
 }
 
 
-void* VG_(arena_realloc) ( ArenaId aid, void* ptr, 
-                           SizeT req_alignB, SizeT req_pszB )
+void* VG_(arena_realloc) ( ArenaId aid, void* ptr, SizeT req_pszB )
 {
    Arena* a;
    SizeT  old_bszB, old_pszB;
@@ -1305,12 +1300,8 @@ void* VG_(arena_realloc) ( ArenaId aid, void* ptr,
       return ptr;
    }
 
-   if (req_alignB == VG_MIN_MALLOC_SZB)
-      p_new = VG_(arena_malloc) ( aid, req_pszB );
-   else {
-      p_new = VG_(arena_malloc_aligned) ( aid, req_alignB, req_pszB );
-   }
-
+   p_new = VG_(arena_malloc) ( aid, req_pszB );
+      
    VG_(memcpy)(p_new, ptr, old_pszB);
 
    VG_(arena_free)(aid, ptr);
@@ -1338,13 +1329,12 @@ void  VG_(free) ( void* ptr )
 
 void* VG_(calloc) ( SizeT nmemb, SizeT bytes_per_memb )
 {
-   return VG_(arena_calloc) ( VG_AR_TOOL, VG_MIN_MALLOC_SZB, nmemb,
-                              bytes_per_memb );
+   return VG_(arena_calloc) ( VG_AR_TOOL, nmemb, bytes_per_memb );
 }
 
 void* VG_(realloc) ( void* ptr, SizeT size )
 {
-   return VG_(arena_realloc) ( VG_AR_TOOL, ptr, VG_MIN_MALLOC_SZB, size );
+   return VG_(arena_realloc) ( VG_AR_TOOL, ptr, size );
 }
 
 void* VG_(malloc_aligned) ( SizeT req_alignB, SizeT req_pszB )
index 8d73517dfa1f179b815d16b9e5b51a84c9e7ec25..d7d9ba8808716751b4827f743bce7e78d7bbd6ca 100644 (file)
@@ -192,20 +192,16 @@ void VGA_(init_thread1state) ( Addr client_eip,
 
 VexGuestX86SegDescr* VG_(alloc_zeroed_x86_GDT) ( void )
 {
-   Int nbytes 
-      = VEX_GUEST_X86_GDT_NENT * sizeof(VexGuestX86SegDescr);
-   return
-      VG_(arena_calloc)(VG_AR_CORE, VG_MIN_MALLOC_SZB, nbytes, 1);
+   Int nbytes = VEX_GUEST_X86_GDT_NENT * sizeof(VexGuestX86SegDescr);
+   return VG_(arena_calloc)(VG_AR_CORE, nbytes, 1);
 }
 
 /* Create a zeroed-out LDT. */
 
 VexGuestX86SegDescr* VG_(alloc_zeroed_x86_LDT) ( void )
 {
-   Int nbytes 
-      = VEX_GUEST_X86_LDT_NENT * sizeof(VexGuestX86SegDescr);
-   return
-      VG_(arena_calloc)(VG_AR_CORE, VG_MIN_MALLOC_SZB, nbytes, 1);
+   Int nbytes = VEX_GUEST_X86_LDT_NENT * sizeof(VexGuestX86SegDescr);
+   return VG_(arena_calloc)(VG_AR_CORE, nbytes, 1);
 }
 
 /* Free up an LDT or GDT allocated by the above fns. */