mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:34:59 +00:00
AK: Exclude StringBuilder String APIs from the Kernel
These APIs are only used by userland, and String is OOM-infallible, so let's just ifdef it out of the Kernel.
This commit is contained in:
parent
43e5c326e2
commit
8f093e91e0
2 changed files with 15 additions and 2 deletions
|
@ -8,13 +8,16 @@
|
|||
#include <AK/Checked.h>
|
||||
#include <AK/PrintfImplementation.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <AK/UnicodeUtils.h>
|
||||
#include <AK/Utf16View.h>
|
||||
#include <AK/Utf32View.h>
|
||||
|
||||
#ifndef KERNEL
|
||||
# include <AK/String.h>
|
||||
# include <AK/Utf16View.h>
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
|
||||
inline ErrorOr<void> StringBuilder::will_append(size_t size)
|
||||
|
@ -87,6 +90,7 @@ ByteBuffer StringBuilder::to_byte_buffer() const
|
|||
return ByteBuffer::copy(data(), length()).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
String StringBuilder::to_string() const
|
||||
{
|
||||
if (is_empty())
|
||||
|
@ -98,6 +102,7 @@ String StringBuilder::build() const
|
|||
{
|
||||
return to_string();
|
||||
}
|
||||
#endif
|
||||
|
||||
StringView StringBuilder::string_view() const
|
||||
{
|
||||
|
@ -125,6 +130,7 @@ void StringBuilder::append_code_point(u32 code_point)
|
|||
MUST(try_append_code_point(code_point));
|
||||
}
|
||||
|
||||
#ifndef KERNEL
|
||||
ErrorOr<void> StringBuilder::try_append(Utf16View const& utf16_view)
|
||||
{
|
||||
for (size_t i = 0; i < utf16_view.length_in_code_units();) {
|
||||
|
@ -140,6 +146,7 @@ void StringBuilder::append(Utf16View const& utf16_view)
|
|||
{
|
||||
MUST(try_append(utf16_view));
|
||||
}
|
||||
#endif
|
||||
|
||||
ErrorOr<void> StringBuilder::try_append(Utf32View const& utf32_view)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue