mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:17:44 +00:00
AK: Avoid temporary String allocation in Formatter<FormatString>
Creating a String object from the formatted data is unnecessary, as it immediately gets turned into a StringView anyways. With this change, we will no longer allocate on the heap when printing `VirtualAddress`, `VirtualRange` and `InodeIdentifier` objects, which is a step towards stronger OOM hardening.
This commit is contained in:
parent
018c4e0e7e
commit
39a74676bd
2 changed files with 4 additions and 2 deletions
|
@ -595,7 +595,7 @@ struct Formatter<FormatIfSupported<T>> : __FormatIfSupported<T, HasFormatter<T>>
|
|||
struct FormatString {
|
||||
};
|
||||
template<>
|
||||
struct Formatter<FormatString> : Formatter<String> {
|
||||
struct Formatter<FormatString> : Formatter<StringView> {
|
||||
template<typename... Parameters>
|
||||
void format(FormatBuilder& builder, StringView fmtstr, const Parameters&... parameters)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue