|
From: <sv...@va...> - 2009-05-04 07:21:36
|
Author: njn
Date: 2009-05-04 08:21:23 +0100 (Mon, 04 May 2009)
New Revision: 9768
Log:
Factor out some code.
Modified:
branches/DARWIN/coregrind/m_initimg/initimg-darwin.c
branches/DARWIN/coregrind/m_initimg/initimg-linux.c
branches/DARWIN/coregrind/m_initimg/initimg-pathscan.c
branches/DARWIN/coregrind/m_initimg/priv_initimg_pathscan.h
branches/DARWIN/coregrind/pub_core_initimg.h
Modified: branches/DARWIN/coregrind/m_initimg/initimg-darwin.c
===================================================================
--- branches/DARWIN/coregrind/m_initimg/initimg-darwin.c 2009-05-04 07:05:34 UTC (rev 9767)
+++ branches/DARWIN/coregrind/m_initimg/initimg-darwin.c 2009-05-04 07:21:23 UTC (rev 9768)
@@ -64,7 +64,7 @@
SysRes res;
vg_assert( VG_(args_the_exename) != NULL);
- exe_name = VG_(find_executable)( VG_(args_the_exename) );
+ exe_name = ML_(find_executable)( VG_(args_the_exename) );
if (!exe_name) {
VG_(printf)("valgrind: %s: command not found\n", VG_(args_the_exename));
Modified: branches/DARWIN/coregrind/m_initimg/initimg-linux.c
===================================================================
--- branches/DARWIN/coregrind/m_initimg/initimg-linux.c 2009-05-04 07:05:34 UTC (rev 9767)
+++ branches/DARWIN/coregrind/m_initimg/initimg-linux.c 2009-05-04 07:21:23 UTC (rev 9768)
@@ -47,6 +47,7 @@
#include "pub_core_syscall.h"
#include "pub_core_tooliface.h" /* VG_TRACK */
#include "pub_core_threadstate.h" /* ThreadArchState */
+#include "priv_initimg_pathscan.h"
#include "pub_core_initimg.h" /* self */
/* --- !!! --- EXTERNAL HEADERS start --- !!! --- */
@@ -136,25 +137,7 @@
}
}
-// Returns NULL if it wasn't found.
-static HChar* find_executable ( HChar* exec )
-{
- vg_assert(NULL != exec);
- if (VG_(strchr)(exec, '/')) {
- // Has a '/' - use the name as is
- VG_(strncpy)( executable_name_out, exec, VKI_PATH_MAX-1 );
- } else {
- // No '/' - we need to search the path
- HChar* path;
- VG_(strncpy)( executable_name_in, exec, VKI_PATH_MAX-1 );
- VG_(memset) ( executable_name_out, 0, VKI_PATH_MAX );
- path = VG_(getenv)("PATH");
- scan_colsep(path, match_executable);
- }
- return VG_STREQ(executable_name_out, "") ? NULL : executable_name_out;
-}
-
/*====================================================================*/
/*=== Loading the client ===*/
/*====================================================================*/
@@ -170,7 +153,7 @@
SysRes res;
vg_assert( VG_(args_the_exename) != NULL);
- exe_name = find_executable( VG_(args_the_exename) );
+ exe_name = ML_(find_executable)( VG_(args_the_exename) );
if (!exe_name) {
VG_(printf)("valgrind: %s: command not found\n", VG_(args_the_exename));
Modified: branches/DARWIN/coregrind/m_initimg/initimg-pathscan.c
===================================================================
--- branches/DARWIN/coregrind/m_initimg/initimg-pathscan.c 2009-05-04 07:05:34 UTC (rev 9767)
+++ branches/DARWIN/coregrind/m_initimg/initimg-pathscan.c 2009-05-04 07:21:23 UTC (rev 9768)
@@ -47,7 +47,9 @@
#include "pub_core_threadstate.h" /* ThreadArchState */
#include "pub_core_initimg.h" /* self */
+#include "priv_initimg_pathscan.h"
+
/*====================================================================*/
/*=== Find executable ===*/
/*====================================================================*/
@@ -128,7 +130,7 @@
}
// Returns NULL if it wasn't found.
-HChar* VG_(find_executable) ( HChar* exec )
+HChar* ML_(find_executable) ( HChar* exec )
{
vg_assert(NULL != exec);
if (VG_(strchr)(exec, '/')) {
Modified: branches/DARWIN/coregrind/m_initimg/priv_initimg_pathscan.h
===================================================================
--- branches/DARWIN/coregrind/m_initimg/priv_initimg_pathscan.h 2009-05-04 07:05:34 UTC (rev 9767)
+++ branches/DARWIN/coregrind/m_initimg/priv_initimg_pathscan.h 2009-05-04 07:21:23 UTC (rev 9768)
@@ -32,7 +32,6 @@
#ifndef __PRIV_INITIMG_PATHSCAN_H
#define __PRIV_INITIMG_PATHSCAN_
-// GrP fixme ML_() ?
-extern HChar* VG_(find_executable) ( HChar* exec );
+extern HChar* ML_(find_executable) ( HChar* exec );
#endif
Modified: branches/DARWIN/coregrind/pub_core_initimg.h
===================================================================
--- branches/DARWIN/coregrind/pub_core_initimg.h 2009-05-04 07:05:34 UTC (rev 9767)
+++ branches/DARWIN/coregrind/pub_core_initimg.h 2009-05-04 07:21:23 UTC (rev 9768)
@@ -60,10 +60,6 @@
extern
void VG_(ii_finalise_image)( IIFinaliseImageInfo );
-/* Search for the named executable in PATH, and return its full path. */
-extern
-HChar* VG_(find_executable) ( HChar* exec );
-
/* Note that both IICreateImageInfo and IIFinaliseImageInfo are
OS-specific. We now go on to give instantiations of them
for supported OSes. */
|