From 53772b2b1a21dbc0aaa00e1b8a770a8a068d30e7 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sun, 18 Feb 2024 09:43:34 +0100 Subject: [PATCH] refactor: Use util::Bytes::insert for span --- src/core/CacheEntry.cpp | 2 +- src/core/CacheEntryDataWriter.hpp | 4 ++-- src/util/file.cpp | 5 +---- 3 files changed, 4 insertions(+), 7 deletions(-) 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; }); } -- 2.47.2