subcontext: Change a std::string argument into std::string_view
This change prevents that a later CL will trigger the following warning: parameter 'test_context' is passed by value and only copied once; consider moving it to avoid unnecessary copies Change-Id: If5837ee6438efdf194781de041779c1089897789 Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
parent
5e524e28ee
commit
462ea55095
|
@ -36,8 +36,10 @@ static constexpr const char kTestContext[] = "test-test-test";
|
||||||
|
|
||||||
class Subcontext {
|
class Subcontext {
|
||||||
public:
|
public:
|
||||||
Subcontext(std::vector<std::string> path_prefixes, std::string context, bool host = false)
|
Subcontext(std::vector<std::string> path_prefixes, std::string_view context, bool host = false)
|
||||||
: path_prefixes_(std::move(path_prefixes)), context_(std::move(context)), pid_(0) {
|
: path_prefixes_(std::move(path_prefixes)),
|
||||||
|
context_(context.begin(), context.end()),
|
||||||
|
pid_(0) {
|
||||||
if (!host) {
|
if (!host) {
|
||||||
Fork();
|
Fork();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue