From: Joel Rosdahl Date: Sat, 3 Sep 2022 11:59:23 +0000 (+0200) Subject: enhance: Support nonstd::span for util::write_file X-Git-Tag: v4.7~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d3286d099848c444cad27fdaf30b15fd7a51176;p=thirdparty%2Fccache.git enhance: Support nonstd::span for util::write_file --- diff --git a/src/util/file.cpp b/src/util/file.cpp index d50d027b7..77b24b539 100644 --- a/src/util/file.cpp +++ b/src/util/file.cpp @@ -246,7 +246,7 @@ write_file(const std::string& path, const std::string& data) } nonstd::expected -write_file(const std::string& path, const util::Blob& data) +write_file(const std::string& path, nonstd::span data) { Fd fd(open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666)); if (!fd) { diff --git a/src/util/file.hpp b/src/util/file.hpp index 886740ff1..dc6596c86 100644 --- a/src/util/file.hpp +++ b/src/util/file.hpp @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -60,7 +61,7 @@ nonstd::expected write_file(const std::string& path, const std::string& data); // Write binary `data` to `path`. -nonstd::expected write_file(const std::string& path, - const util::Blob& data); +nonstd::expected +write_file(const std::string& path, nonstd::span data); } // namespace util