From: Joel Rosdahl Date: Sun, 18 Feb 2024 08:43:34 +0000 (+0100) Subject: refactor: Use util::Bytes::insert for span X-Git-Tag: v4.10~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53772b2b1a21dbc0aaa00e1b8a770a8a068d30e7;p=thirdparty%2Fccache.git refactor: Use util::Bytes::insert for span --- diff --git a/src/core/CacheEntry.cpp b/src/core/CacheEntry.cpp index 0009ecc7..4cfe6bee 100644 --- a/src/core/CacheEntry.cpp +++ b/src/core/CacheEntry.cpp @@ -285,7 +285,7 @@ CacheEntry::serialize(const CacheEntry::Header& header, [&payload](util::Bytes& result, const CacheEntry::Header& hdr) { switch (hdr.compression_type) { case CompressionType::none: - result.insert(result.end(), payload.begin(), payload.end()); + result.insert(result.end(), payload); break; case CompressionType::zstd: diff --git a/src/core/CacheEntryDataWriter.hpp b/src/core/CacheEntryDataWriter.hpp index 19e91272..6e18be52 100644 --- a/src/core/CacheEntryDataWriter.hpp +++ b/src/core/CacheEntryDataWriter.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2022-2023 Joel Rosdahl and other contributors +// Copyright (C) 2022-2024 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -57,7 +57,7 @@ inline CacheEntryDataWriter::CacheEntryDataWriter(util::Bytes& output) inline void CacheEntryDataWriter::write_bytes(nonstd::span data) { - m_output.insert(m_output.end(), data.begin(), data.end()); + m_output.insert(m_output.end(), data); } template diff --git a/src/util/file.cpp b/src/util/file.cpp index 87600422..4ef39044 100644 --- a/src/util/file.cpp +++ b/src/util/file.cpp @@ -211,10 +211,7 @@ tl::expected read_fd(int fd) { Bytes output; - return read_fd(fd, - [&](auto data) { - output.insert(output.end(), data.begin(), data.end()); - }) + return read_fd(fd, [&](auto data) { output.insert(output.end(), data); }) .transform([&] { return output; }); }