]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Moved VG_(strdup)() and VG_(arena_strdup)() into m_mallocfree.
authorNicholas Nethercote <njn@valgrind.org>
Sat, 11 Jun 2005 01:12:08 +0000 (01:12 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Sat, 11 Jun 2005 01:12:08 +0000 (01:12 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3878

coregrind/core.h
coregrind/m_mallocfree.c
coregrind/pub_core_mallocfree.h
coregrind/vg_mylibc.c
include/pub_tool_libcbase.h
include/pub_tool_mallocfree.h

index 1774511b86c4a759ed01c6c7f066e389417ab8f8..2f5a46a3ca26856fccb2890c09f81840bf17dc0b 100644 (file)
    Exports of vg_mylibc.c
    ------------------------------------------------------------------ */
 
-/* Tools use VG_(strdup)() which doesn't expose ArenaId */
-extern Char* VG_(arena_strdup) ( ArenaId aid, const Char* s);
-
 extern Int VG_(fcntl) ( Int fd, Int cmd, Int arg );
 extern Int VG_(poll)( struct vki_pollfd *, UInt nfds, Int timeout);
 
index 235c923bb15c371b283ae7f779efe30d19d81cb3..e1f1e1aa69da8a02d0945baba7b6470e229773c8 100644 (file)
@@ -1263,6 +1263,25 @@ void* VG_(arena_realloc) ( ArenaId aid, void* ptr, SizeT req_pszB )
 }
 
 
+/* Inline just for the wrapper VG_(strdup) below */
+__inline__ Char* VG_(arena_strdup) ( ArenaId aid, const Char* s )
+{
+   Int   i;
+   Int   len;
+   Char* res;
+
+   if (s == NULL)
+      return NULL;
+
+   len = VG_(strlen)(s) + 1;
+   res = VG_(arena_malloc) (aid, len);
+
+   for (i = 0; i < len; i++)
+      res[i] = s[i];
+   return res;
+}
+
+
 /*------------------------------------------------------------*/
 /*--- Tool-visible functions.                              ---*/
 /*------------------------------------------------------------*/
@@ -1289,6 +1308,11 @@ void* VG_(realloc) ( void* ptr, SizeT size )
    return VG_(arena_realloc) ( VG_AR_TOOL, ptr, size );
 }
 
+Char* VG_(strdup) ( const Char* s )
+{
+   return VG_(arena_strdup) ( VG_AR_TOOL, s ); 
+}
+
 /*--------------------------------------------------------------------*/
 /*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
index f6d0ea14a349d23598c114b6625bb5c349f148c2..b5b7ec22bbfe716d3d001cc3a81611f7efab8b7a 100644 (file)
@@ -75,6 +75,7 @@ extern void* VG_(arena_calloc)  ( ArenaId arena,
 extern void* VG_(arena_realloc) ( ArenaId arena, void* ptr, SizeT size );
 extern void* VG_(arena_memalign)( ArenaId aid, SizeT req_alignB, 
                                                SizeT req_pszB );
+extern Char* VG_(arena_strdup)  ( ArenaId aid, const Char* s);
 
 /* Sets the size of the redzones at the start and end of heap blocks.  This
    must be called before any of VG_(malloc) and friends are called. */
index 147ecd531b1b350c56781f6f32e8c430ca56678c..55ed2de0e1fda8fd1eaa8d22b00c1dc5a1006979 100644 (file)
@@ -208,34 +208,6 @@ Int VG_(poll)( struct vki_pollfd *ufds, UInt nfds, Int timeout)
 }
 
 
-/* ---------------------------------------------------------------------
-   strdup()
-   ------------------------------------------------------------------ */
-
-/* Inline just for the wrapper VG_(strdup) below */
-__inline__ Char* VG_(arena_strdup) ( ArenaId aid, const Char* s )
-{
-   Int   i;
-   Int   len;
-   Char* res;
-
-   if (s == NULL)
-      return NULL;
-
-   len = VG_(strlen)(s) + 1;
-   res = VG_(arena_malloc) (aid, len);
-
-   for (i = 0; i < len; i++)
-      res[i] = s[i];
-   return res;
-}
-
-/* Wrapper to avoid exposing tools to ArenaId's */
-Char* VG_(strdup) ( const Char* s )
-{
-   return VG_(arena_strdup) ( VG_AR_TOOL, s ); 
-}
-
 /* ---------------------------------------------------------------------
    Misc functions looking for a proper home.
    ------------------------------------------------------------------ */
index b60c891616f3a177fedd10946d6c8013359a3b36..e96a8c58878f3a6a42018f60df69edc5ee046433 100644 (file)
@@ -64,7 +64,6 @@ extern Int   VG_(strncmp)        ( const Char* s1, const Char* s2, SizeT nmax );
 extern Char* VG_(strstr)         ( const Char* haystack, Char* needle );
 extern Char* VG_(strchr)         ( const Char* s, Char c );
 extern Char* VG_(strrchr)        ( const Char* s, Char c );
-extern Char* VG_(strdup)         ( const Char* s);
 
 /* Like strcmp() and strncmp(), but stop comparing at any whitespace. */
 extern Int   VG_(strcmp_ws)      ( const Char* s1, const Char* s2 );
index d89edaf79947a2e82af5d79aab3efb4941360a10..1fbf9f5c044a8ad952795b3ac581936ca60fd0aa 100644 (file)
@@ -37,6 +37,7 @@ 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 Char* VG_(strdup)         ( const Char* s );
 
 #endif   // __PUB_TOOL_MALLOCFREE_H