Skip to content

Commit

Permalink
spawn/Prepared: pass std::string_view to SetEnv()
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Oct 23, 2023
1 parent 719f80c commit 389596e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/spawn/Prepared.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ PreparedChildProcess::InsertWrapper(std::span<const char *const> w) noexcept
}

void
PreparedChildProcess::SetEnv(const char *name, const char *value) noexcept
PreparedChildProcess::SetEnv(std::string_view name, std::string_view value) noexcept
{
assert(name != nullptr);
assert(value != nullptr);
assert(!name.empty());

strings.emplace_front(name);
auto &s = strings.front();
Expand Down
2 changes: 1 addition & 1 deletion src/spawn/Prepared.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ struct PreparedChildProcess {
env.push_back(p);
}

void SetEnv(const char *name, const char *value) noexcept;
void SetEnv(std::string_view name, std::string_view value) noexcept;

const char *GetEnv(std::string_view name) const noexcept;

Expand Down

0 comments on commit 389596e

Please sign in to comment.