summaryrefslogtreecommitdiff
path: root/AK/Format.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-02-16 00:03:54 +0200
committerAndreas Kling <kling@serenityos.org>2022-02-16 22:21:37 +0100
commite95470702e574250f49947b68e7f9b8a94f6e2c4 (patch)
treeec46ebd2546e3bdaa5199ac55b7f6526af20e8cb /AK/Format.cpp
parentccad3d5a39b9230510f1cead786ab0dd5d157652 (diff)
downloadserenity-e95470702e574250f49947b68e7f9b8a94f6e2c4.zip
AK: Use string_view() instead of to_string() in Formatter<wchar_t>
This let's us avoid a heap allocation.
Diffstat (limited to 'AK/Format.cpp')
-rw-r--r--AK/Format.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/AK/Format.cpp b/AK/Format.cpp
index 4c00e3f6da..63e9ff8689 100644
--- a/AK/Format.cpp
+++ b/AK/Format.cpp
@@ -8,7 +8,6 @@
#include <AK/Format.h>
#include <AK/GenericLexer.h>
#include <AK/IntegralMath.h>
-#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/kstdio.h>
@@ -777,7 +776,7 @@ ErrorOr<void> Formatter<wchar_t>::format(FormatBuilder& builder, wchar_t value)
codepoint.append_code_point(value);
Formatter<StringView> formatter { *this };
- return formatter.format(builder, codepoint.to_string());
+ return formatter.format(builder, codepoint.string_view());
}
}
ErrorOr<void> Formatter<bool>::format(FormatBuilder& builder, bool value)