slightly nicer code

This commit is contained in:
VaclavT 2021-05-03 18:29:29 +02:00
parent a2a01dd676
commit 78f870c17d
2 changed files with 3 additions and 10 deletions

7
ml.cpp
View File

@ -1142,11 +1142,8 @@ namespace builtin {
} }
std::pair<long, std::string> result = client.doGetRequest(args[0].as_string(), headers); std::pair<long, std::string> result = client.doGetRequest(args[0].as_string(), headers);
// TODO add helper function for this
std::vector<MlValue> lst; return std::vector<MlValue> { MlValue(result.first), MlValue::string(result.second) };
lst.push_back(MlValue(result.first));
lst.push_back(MlValue::string(result.second));
return lst;
} }
// Parse JSON string // Parse JSON string

View File

@ -91,9 +91,5 @@ MlValue exec_system_cmd(const std::string &cmd) {
stat = pclose(pipe); stat = pclose(pipe);
int cmd_retval = WEXITSTATUS(stat); int cmd_retval = WEXITSTATUS(stat);
// TODO add helper function for this return std::vector<MlValue> { MlValue((long)cmd_retval), MlValue::string(cmd_output) };
std::vector<MlValue> lst;
lst.push_back(MlValue((long)cmd_retval));
lst.push_back(MlValue::string(cmd_output));
return lst;
} }