diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2020-08-03 21:07:32 +0200 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2020-08-03 21:31:02 +0200 |
commit | 0f8e918ca267b254e2d17dd8a20237447b3dcb65 (patch) | |
tree | f529f2778ecc4898c4725e52dc731a15794f1add /src/AtomicFile.cpp | |
parent | adfca03bb4f9f4d53fa36aed29a64832ed2661c8 (diff) | |
download | ccache-0f8e918ca267b254e2d17dd8a20237447b3dcb65.tar.gz |
Let Error constructor forward arguments to fmt::format
Diffstat (limited to 'src/AtomicFile.cpp')
-rw-r--r-- | src/AtomicFile.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/AtomicFile.cpp b/src/AtomicFile.cpp index b227af4f..8c7d6c7b 100644 --- a/src/AtomicFile.cpp +++ b/src/AtomicFile.cpp @@ -22,8 +22,6 @@ #include "Util.hpp" #include "exceptions.hpp" -#include "third_party/fmt/core.h" - AtomicFile::AtomicFile(const std::string& path, Mode mode) : m_path(path) { TemporaryFile tmp_file(path + ".tmp"); @@ -44,8 +42,7 @@ void AtomicFile::write(const std::string& data) { if (fwrite(data.data(), data.size(), 1, m_stream) != 1) { - throw Error( - fmt::format("failed to write data to {}: {}", m_path, strerror(errno))); + throw Error("failed to write data to {}: {}", m_path, strerror(errno)); } } @@ -53,8 +50,7 @@ void AtomicFile::write(const std::vector<uint8_t>& data) { if (fwrite(data.data(), data.size(), 1, m_stream) != 1) { - throw Error( - fmt::format("failed to write data to {}: {}", m_path, strerror(errno))); + throw Error("failed to write data to {}: {}", m_path, strerror(errno)); } } @@ -66,8 +62,7 @@ AtomicFile::commit() m_stream = nullptr; if (result == EOF) { Util::unlink_tmp(m_tmp_path); - throw Error( - fmt::format("failed to write data to {}: {}", m_path, strerror(errno))); + throw Error("failed to write data to {}: {}", m_path, strerror(errno)); } Util::rename(m_tmp_path, m_path); } |