summaryrefslogtreecommitdiffstats
path: root/drivers/unix/os_unix.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-05-07 09:04:44 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-05-07 09:04:44 +0200
commite63252b4219680d109bfa41c24f483e97b37f40e (patch)
tree8b8af6d7efcab9b2692d45dec65449fd83d2c8b9 /drivers/unix/os_unix.cpp
parent570220ba9b127325f1a5aa7bb17d5c6f76ccf62c (diff)
parent955d5affa857ec1f358c56da8fb1ff4ab6590704 (diff)
downloadredot-engine-e63252b4219680d109bfa41c24f483e97b37f40e.tar.gz
Merge pull request #90705 from AThousandShips/foreach_list
Reduce and prevent unnecessary random-access to `List`
Diffstat (limited to 'drivers/unix/os_unix.cpp')
-rw-r--r--drivers/unix/os_unix.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index 0a79c8014b..ce2553456d 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -546,8 +546,8 @@ Dictionary OS_Unix::execute_with_pipe(const String &p_path, const List<String> &
// The child process.
Vector<CharString> cs;
cs.push_back(p_path.utf8());
- for (int i = 0; i < p_arguments.size(); i++) {
- cs.push_back(p_arguments[i].utf8());
+ for (const String &arg : p_arguments) {
+ cs.push_back(arg.utf8());
}
Vector<char *> args;
@@ -606,8 +606,8 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, St
#else
if (r_pipe) {
String command = "\"" + p_path + "\"";
- for (int i = 0; i < p_arguments.size(); i++) {
- command += String(" \"") + p_arguments[i] + "\"";
+ for (const String &arg : p_arguments) {
+ command += String(" \"") + arg + "\"";
}
if (read_stderr) {
command += " 2>&1"; // Include stderr
@@ -647,8 +647,8 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, St
// The child process
Vector<CharString> cs;
cs.push_back(p_path.utf8());
- for (int i = 0; i < p_arguments.size(); i++) {
- cs.push_back(p_arguments[i].utf8());
+ for (const String &arg : p_arguments) {
+ cs.push_back(arg.utf8());
}
Vector<char *> args;
@@ -689,8 +689,8 @@ Error OS_Unix::create_process(const String &p_path, const List<String> &p_argume
Vector<CharString> cs;
cs.push_back(p_path.utf8());
- for (int i = 0; i < p_arguments.size(); i++) {
- cs.push_back(p_arguments[i].utf8());
+ for (const String &arg : p_arguments) {
+ cs.push_back(arg.utf8());
}
Vector<char *> args;