mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 17:24:48 -05:00
Kernel: Avoid allocations in KBufferBuilder::appendff
This avoids some of the the shortest-lived allocations in the kernel: StringImpl::create_uninitialized(unsigned long, char*&) StringImpl::create(char const*, unsigned long, ShouldChomp) StringBuilder::to_string() const String::vformatted(StringView, TypeErasedFormatParams) void Kernel::KBufferBuilder::appendff<unsigned int>(...) JsonObjectSerializer<Kernel::KBufferBuilder>::add(..., unsigned int) Kernel::procfs$all(Kernel::InodeIdentifier, ...) const Kernel::procfs$all(Kernel::InodeIdentifier, Kernel::KBufferBuilder&)
This commit is contained in:
parent
1bb20a255f
commit
93c3b6bdd2
Notes:
sideshowbarker
2024-07-18 18:16:21 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/93c3b6bdd24 Pull-request: https://github.com/SerenityOS/serenity/pull/7063
1 changed files with 3 additions and 1 deletions
|
@ -33,7 +33,9 @@ public:
|
|||
{
|
||||
// FIXME: This is really not the way to go about it, but vformat expects a
|
||||
// StringBuilder. Why does this class exist anyways?
|
||||
append(String::formatted(fmtstr.view(), parameters...));
|
||||
StringBuilder builder;
|
||||
vformat(builder, fmtstr.view(), AK::VariadicFormatParams { parameters... });
|
||||
append_bytes(builder.string_view().bytes());
|
||||
}
|
||||
|
||||
bool flush();
|
||||
|
|
Loading…
Reference in a new issue