AK+Kernel: Don't allow AK::String in the kernel

Kernel code should use KString instead. Compared to AK::String, KString
is a very simple string class that just wraps a char array and doesn't
have any fancy features such as reference counting.
This commit is contained in:
Sönke Holz
2025-11-15 21:05:50 +01:00
committed by Sönke Holz
parent b7418e74d3
commit fff1e543bf
6 changed files with 12 additions and 9 deletions

View File

@@ -9,7 +9,6 @@
#include <AK/FormatParser.h>
#include <AK/GenericLexer.h>
#include <AK/IntegralMath.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/kstdio.h>
@@ -24,16 +23,14 @@
# include <Kernel/Time/TimeManagement.h>
#else
# include <AK/LexicalPath.h>
# include <AK/String.h>
# include <AK/StringFloatingPointConversions.h>
# include <math.h>
# include <stdio.h>
# include <string.h>
# include <time.h>
#endif
#ifndef KERNEL
# include <AK/StringFloatingPointConversions.h>
#endif
namespace AK {
namespace {

View File

@@ -9,9 +9,12 @@
#include <AK/NonnullOwnPtr.h>
#include <AK/RedBlackTree.h>
#include <AK/Result.h>
#include <AK/String.h>
#include <AK/StringView.h>
#ifndef KERNEL
# include <AK/String.h>
#endif
namespace AK {
class GenericLexer {

View File

@@ -7,6 +7,10 @@
#pragma once
#ifdef KERNEL
# error This file should not be included in the kernel. Use KString instead.
#endif
#include <AK/CharacterTypes.h>
#include <AK/Concepts.h>
#include <AK/Format.h>

View File

@@ -8,7 +8,6 @@
#include <AK/ByteBuffer.h>
#include <AK/Checked.h>
#include <AK/PrintfImplementation.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/StringView.h>
#include <AK/UnicodeUtils.h>
@@ -17,6 +16,7 @@
#ifndef KERNEL
# include <AK/ByteString.h>
# include <AK/FlyString.h>
# include <AK/String.h>
# include <AK/Utf16View.h>
#endif

View File

@@ -9,7 +9,6 @@
#include <AK/Hex.h>
#include <AK/MemMem.h>
#include <AK/Optional.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/StringUtils.h>
#include <AK/StringView.h>
@@ -22,6 +21,7 @@
#else
# include <AK/ByteString.h>
# include <AK/FloatingPointStringConversions.h>
# include <AK/String.h>
# include <string.h>
#endif

View File

@@ -5,7 +5,6 @@
*/
#include <AK/Span.h>
#include <AK/String.h>
#include <Kernel/Bus/PCI/Driver.h>
#include <Kernel/Bus/PCI/IDs.h>
#include <Kernel/Bus/VirtIO/Transport/PCIe/TransportLink.h>