diff options
author | Zachary Turner <zturner@google.com> | 2016-10-05 23:40:23 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-10-05 23:40:23 +0000 |
commit | 97d2c4011b9ccdfb9da2c5d4cb6917c9a2a18225 (patch) | |
tree | 73b9e3ce319cf6ece6d441bc75611363d81e1d30 /lldb/source/Host/linux/ProcessLauncherLinux.cpp | |
parent | 3b564e97655e0eb732219d5a4dec6c31a34f7aa9 (diff) | |
download | bcm5719-llvm-97d2c4011b9ccdfb9da2c5d4cb6917c9a2a18225.tar.gz bcm5719-llvm-97d2c4011b9ccdfb9da2c5d4cb6917c9a2a18225.zip |
Convert some Args index-based iteration to range-style iteration.
This is better for a number of reasons. Mostly style, but also:
1) Signed-unsigned comparison warnings disappear since there is
no loop index.
2) Iterating with the range-for style gives you back an entry
that has more than just a const char*, so it's more efficient
and more useful.
3) Makes code safter since the type system enforces that it's
impossible to index out of bounds.
llvm-svn: 283413
Diffstat (limited to 'lldb/source/Host/linux/ProcessLauncherLinux.cpp')
-rw-r--r-- | lldb/source/Host/linux/ProcessLauncherLinux.cpp | 6 |
1 files changed, 2 insertions, 4 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")); |