|
From: <sv...@va...> - 2005-06-11 01:12:14
|
Author: njn
Date: 2005-06-11 02:12:08 +0100 (Sat, 11 Jun 2005)
New Revision: 3878
Log:
Moved VG_(strdup)() and VG_(arena_strdup)() into m_mallocfree.
Modified:
trunk/coregrind/core.h
trunk/coregrind/m_mallocfree.c
trunk/coregrind/pub_core_mallocfree.h
trunk/coregrind/vg_mylibc.c
trunk/include/pub_tool_libcbase.h
trunk/include/pub_tool_mallocfree.h
Modified: trunk/coregrind/core.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/core.h 2005-06-11 01:07:00 UTC (rev 3877)
+++ trunk/coregrind/core.h 2005-06-11 01:12:08 UTC (rev 3878)
@@ -131,9 +131,6 @@
Exports of vg_mylibc.c
------------------------------------------------------------------ */
=20
-/* 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);
=20
Modified: trunk/coregrind/m_mallocfree.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_mallocfree.c 2005-06-11 01:07:00 UTC (rev 3877)
+++ trunk/coregrind/m_mallocfree.c 2005-06-11 01:12:08 UTC (rev 3878)
@@ -1263,6 +1263,25 @@
}
=20
=20
+/* 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 =3D=3D NULL)
+ return NULL;
+
+ len =3D VG_(strlen)(s) + 1;
+ res =3D VG_(arena_malloc) (aid, len);
+
+ for (i =3D 0; i < len; i++)
+ res[i] =3D s[i];
+ return res;
+}
+
+
/*------------------------------------------------------------*/
/*--- Tool-visible functions. ---*/
/*------------------------------------------------------------*/
@@ -1289,6 +1308,11 @@
return VG_(arena_realloc) ( VG_AR_TOOL, ptr, size );
}
=20
+Char* VG_(strdup) ( const Char* s )
+{
+ return VG_(arena_strdup) ( VG_AR_TOOL, s );=20
+}
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/pub_core_mallocfree.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_mallocfree.h 2005-06-11 01:07:00 UTC (rev 38=
77)
+++ trunk/coregrind/pub_core_mallocfree.h 2005-06-11 01:12:08 UTC (rev 38=
78)
@@ -75,6 +75,7 @@
extern void* VG_(arena_realloc) ( ArenaId arena, void* ptr, SizeT size )=
;
extern void* VG_(arena_memalign)( ArenaId aid, SizeT req_alignB,=20
SizeT req_pszB );
+extern Char* VG_(arena_strdup) ( ArenaId aid, const Char* s);
=20
/* Sets the size of the redzones at the start and end of heap blocks. T=
his
must be called before any of VG_(malloc) and friends are called. */
Modified: trunk/coregrind/vg_mylibc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/vg_mylibc.c 2005-06-11 01:07:00 UTC (rev 3877)
+++ trunk/coregrind/vg_mylibc.c 2005-06-11 01:12:08 UTC (rev 3878)
@@ -209,34 +209,6 @@
=20
=20
/* ---------------------------------------------------------------------
- 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 =3D=3D NULL)
- return NULL;
-
- len =3D VG_(strlen)(s) + 1;
- res =3D VG_(arena_malloc) (aid, len);
-
- for (i =3D 0; i < len; i++)
- res[i] =3D 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 );=20
-}
-
-/* ---------------------------------------------------------------------
Misc functions looking for a proper home.
------------------------------------------------------------------ */
=20
Modified: trunk/include/pub_tool_libcbase.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/pub_tool_libcbase.h 2005-06-11 01:07:00 UTC (rev 3877)
+++ trunk/include/pub_tool_libcbase.h 2005-06-11 01:12:08 UTC (rev 3878)
@@ -64,7 +64,6 @@
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);
=20
/* Like strcmp() and strncmp(), but stop comparing at any whitespace. */
extern Int VG_(strcmp_ws) ( const Char* s1, const Char* s2 );
Modified: trunk/include/pub_tool_mallocfree.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/pub_tool_mallocfree.h 2005-06-11 01:07:00 UTC (rev 3877=
)
+++ trunk/include/pub_tool_mallocfree.h 2005-06-11 01:12:08 UTC (rev 3878=
)
@@ -37,6 +37,7 @@
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 );
=20
#endif // __PUB_TOOL_MALLOCFREE_H
=20
|