summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2022-10-16 10:17:01 +0200
committerJoel Rosdahl <joel@rosdahl.net>2022-10-16 10:50:10 +0200
commit3ec0d4ec961cb0c67ff1603b83a6026d9f3abbb5 (patch)
treef5356ad812eda01a5a59c2290645a7c7b3ecc79e /src/core
parent4e1c615602eff875366a3374442a1e96937858a0 (diff)
downloadccache-3ec0d4ec961cb0c67ff1603b83a6026d9f3abbb5.tar.gz
refactor: Avoid an extra data copy when rewriting stdout
Diffstat (limited to 'src/core')
-rw-r--r--src/core/MsvcShowIncludesOutput.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/MsvcShowIncludesOutput.cpp b/src/core/MsvcShowIncludesOutput.cpp
index 5289eadc..311a1bcb 100644
--- a/src/core/MsvcShowIncludesOutput.cpp
+++ b/src/core/MsvcShowIncludesOutput.cpp
@@ -61,16 +61,16 @@ strip_includes(const Context& ctx, util::Bytes&& stdout_data)
return std::move(stdout_data);
}
- std::string new_stdout_text;
+ util::Bytes new_stdout_data;
for (const auto line : Tokenizer(util::to_string_view(stdout_data),
"\n",
Mode::include_empty,
IncludeDelimiter::yes)) {
if (!util::starts_with(line, ctx.config.msvc_dep_prefix())) {
- new_stdout_text.append(line.data(), line.length());
+ new_stdout_data.insert(new_stdout_data.end(), line.data(), line.size());
}
}
- return util::Bytes(new_stdout_text.data(), new_stdout_text.size());
+ return new_stdout_data;
}
} // namespace core::MsvcShowIncludesOutput