refactor(tvix): Make static strings constexpr string_views
Make all static std::strings constexpr std::string_views, and replace concatenation with absl::StrCat where necessary. Technically all of these are constant, so they really don't need to be top-level statics - and since I'm trying to get rid of as much global state as possible in preparation for making the nix daemon properly multithreaded I figured I'd knock these out while I was at it. Change-Id: Ibd3ad9ef68f0a0eacb135541b39fdb13dae042e1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1939 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
parent
31b06516f3
commit
381ce8a666
8 changed files with 46 additions and 42 deletions
6
third_party/nix/src/libstore/build.cc
vendored
6
third_party/nix/src/libstore/build.cc
vendored
|
|
@ -81,7 +81,7 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
static std::string pathNullDevice = "/dev/null";
|
||||
constexpr std::string_view kPathNullDevice = "/dev/null";
|
||||
|
||||
/* Forward definition. */
|
||||
class Worker;
|
||||
|
|
@ -448,9 +448,9 @@ static void commonChildInit(Pipe& logPipe) {
|
|||
}
|
||||
|
||||
/* Reroute stdin to /dev/null. */
|
||||
int fdDevNull = open(pathNullDevice.c_str(), O_RDWR);
|
||||
int fdDevNull = open(kPathNullDevice.begin(), O_RDWR);
|
||||
if (fdDevNull == -1) {
|
||||
throw SysError(format("cannot open '%1%'") % pathNullDevice);
|
||||
throw SysError(format("cannot open '%1%'") % kPathNullDevice);
|
||||
}
|
||||
if (dup2(fdDevNull, STDIN_FILENO) == -1) {
|
||||
throw SysError("cannot dup null device into stdin");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue