diff options
Diffstat (limited to 'lldb/source/Host')
-rw-r--r-- | lldb/source/Host/linux/ProcessLauncherLinux.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Host/windows/ProcessLauncherWindows.cpp | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/lldb/source/Host/linux/ProcessLauncherLinux.cpp b/lldb/source/Host/linux/ProcessLauncherLinux.cpp index cc18fed8654..d88080780b1 100644 --- a/lldb/source/Host/linux/ProcessLauncherLinux.cpp +++ b/lldb/source/Host/linux/ProcessLauncherLinux.cpp @@ -31,10 +31,8 @@ static void FixupEnvironment(Args &env) { // path to /system/bin. It is required because the default path used by // execve() is wrong on android. static const char *path = "PATH="; - static const int path_len = ::strlen(path); - for (size_t i = 0; i < env.GetArgumentCount(); ++i) { - const char *arg = env.GetArgumentAtIndex(i); - if (::strncmp(path, arg, path_len) == 0) + for (auto &entry : entries) { + if (entry.ref.startswith(path)) return; } env.AppendArgument(llvm::StringRef("PATH=/system/bin")); diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp index f881a0247dc..16805ba7df8 100644 --- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp +++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp @@ -26,9 +26,9 @@ void CreateEnvironmentBuffer(const Args &env, std::vector<char> &buffer) { return; // Environment buffer is a null terminated list of null terminated strings - for (size_t i = 0; i < env.GetArgumentCount(); ++i) { + for (auto &entry : env.entries()) { std::wstring warg; - if (llvm::ConvertUTF8toWide(env.GetArgumentAtIndex(i), warg)) { + if (llvm::ConvertUTF8toWide(entry.ref, warg)) { buffer.insert(buffer.end(), (char *)warg.c_str(), (char *)(warg.c_str() + warg.size() + 1)); } |