From 2d3286d099848c444cad27fdaf30b15fd7a51176 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sat, 3 Sep 2022 13:59:23 +0200 Subject: [PATCH] enhance: Support nonstd::span for util::write_file --- src/util/file.cpp | 2 +- src/util/file.hpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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 -- 2.47.2