aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/util.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-12-02 12:43:52 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-12-02 14:17:27 +0100
commitaa684861127eabc18a0d7386a66c5b75d4962897 (patch)
treeb9ae5438f058a4679ab8ee2965e5609572bd69f4 /src/libutil/util.cc
parente5cf501c774bad1dfcde1aff9af0c5fc8c0d333d (diff)
writeFull/writeFile: Use std::string_view
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r--src/libutil/util.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index c1b12e725..98a069c3e 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -320,7 +320,7 @@ void readFile(const Path & path, Sink & sink)
}
-void writeFile(const Path & path, const string & s, mode_t mode)
+void writeFile(const Path & path, std::string_view s, mode_t mode)
{
AutoCloseFD fd = open(path.c_str(), O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, mode);
if (!fd)
@@ -663,7 +663,7 @@ void writeFull(int fd, const unsigned char * buf, size_t count, bool allowInterr
}
-void writeFull(int fd, const string & s, bool allowInterrupts)
+void writeFull(int fd, std::string_view s, bool allowInterrupts)
{
writeFull(fd, (const unsigned char *) s.data(), s.size(), allowInterrupts);
}