mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00: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
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…
Add table
Add a link
Reference in a new issue