From: Nadav Har'El <n...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master
osv::run const correctness
The variant of osv::run which takes argv does not need the strings or
their array to be writable, since it copies them into an std::vector
anyway, so we can take a const char* const* instead of a char**.
Also fix non-const string warnings in tst-run.cc.
Signed-off-by: Nadav Har'El <n...@scylladb.com>
---
diff --git a/core/run.cc b/core/run.cc
--- a/core/run.cc
+++ b/core/run.cc
@@ -16,7 +16,7 @@ std::shared_ptr<osv::application> run(std::string path,
}
std::shared_ptr<osv::application> run(std::string path,
- int argc, char** argv, int *return_code)
+ int argc, const char* const* argv, int
*return_code)
{
std::vector<std::string> args;
for (int i = 0; i < argc; i++) {
diff --git a/include/osv/run.hh b/include/osv/run.hh
--- a/include/osv/run.hh
+++ b/include/osv/run.hh
@@ -78,7 +78,7 @@ namespace osv {
* \return \c shared pointer to the application
*/
std::shared_ptr<osv::application> run(std::string path,
- int argc, char** argv, int
*return_code);
+ int argc, const char* const* argv,
int *return_code);
/**
* Run the given executable.
diff --git a/tests/tst-run.cc b/tests/tst-run.cc
--- a/tests/tst-run.cc
+++ b/tests/tst-run.cc
@@ -31,7 +31,7 @@ int main(int ac, char** av)
}
// See that I can run myself (with a special argument to stop the
recursion)
- char *child_args[] = {"/tests/tst-run.so", ""};
+ const char *child_args[] = {"/tests/tst-run.so", ""};
int ret;
bool b = (bool)osv::run("/tests/tst-run.so", 2, child_args, &ret);
report(b == true, "Run myself");
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.