aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libutil/util.cc4
-rw-r--r--src/libutil/util.hh4
2 files changed, 4 insertions, 4 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);
}
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 117fe86e7..eb872dd4b 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -106,7 +106,7 @@ string readFile(const Path & path);
void readFile(const Path & path, Sink & sink);
/* Write a string to a file. */
-void writeFile(const Path & path, const string & s, mode_t mode = 0666);
+void writeFile(const Path & path, std::string_view s, mode_t mode = 0666);
void writeFile(const Path & path, Source & source, mode_t mode = 0666);
@@ -157,7 +157,7 @@ void replaceSymlink(const Path & target, const Path & link,
requested number of bytes. */
void readFull(int fd, unsigned char * buf, size_t count);
void writeFull(int fd, const unsigned char * buf, size_t count, bool allowInterrupts = true);
-void writeFull(int fd, const string & s, bool allowInterrupts = true);
+void writeFull(int fd, std::string_view s, bool allowInterrupts = true);
MakeError(EndOfFile, Error);