summaryrefslogtreecommitdiff
path: root/Kernel/KString.h
AgeCommit message (Collapse)Author
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-01-29Kernel: Make {Nonnull,}OwnPtr<KString> hash compatible with StringViewIdan Horowitz
This will allow us to use KString as HashTable/HashMap keys more easily
2022-01-13Kernel: Add a KString::bytes() helperIdan Horowitz
2022-01-12Kernel: Add an error propagating KString::number() APIIdan Horowitz
This is simply a thin wrapper around the already existing KString::formatted() API.
2021-11-30Kernel: Add an error propagating KString::format(..) API :^)Brian Gianforcaro
In the continuous effort of better handling OOM in the kernel, we want to move away from all AK::String usage. One of the final pieces left to accomplish this goal is replacing all of the usages of `String::formatted` with something that can actually propagate failure. The StringBuilder API was enhanced in the recent past to propagate failure and thus a slightly modified version of what exists in `AK::format` will work well for implementing failable format with `KString`.
2021-11-17AK: Convert AK::Format formatting helpers to returning ErrorOr<void>Andreas Kling
This isn't a complete conversion to ErrorOr<void>, but a good chunk. The end goal here is to propagate buffer allocation failures to the caller, and allow the use of TRY() with formatting functions.
2021-11-08Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>Andreas Kling
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace! This was a slightly tedious refactoring that took a long time, so it's not unlikely that some bugs crept in. Nevertheless, it does pass basic functionality testing, and it's just real nice to finally see the same pattern in all contexts. :^)
2021-10-30Kernel: Fix common misuse of KString in debug messagesBen Wiederhake
2021-09-13Kernel: Specialize Traits<(Nonnull)OwnPtr<T>> for KStringAli Mohammad Pur
To make it behave like a string, since KString is always stored as a (Nonnull)OwnPtr in the kernel.
2021-09-07Kernel: Remove redundant [[nodiscard]] on KResult return valuesAndreas Kling
Both KResult and KResultOr are [[nodiscard]] at the class level, so there's no need to have functions return `[[nodiscard]] KResult`.
2021-09-06Kernel: Make KString factories return KResultOr + use TRY() everywhereAndreas Kling
There are a number of places that don't have an error propagation path right now, so I've added FIXME's about that.
2021-08-13Kernel: Annotate KString methods as [[nodiscard]]Brian Gianforcaro
2021-07-07Kernel: Add formatter function for OwnPtr<KString>Max Wipfli
This adds a formatter function for OwnPtr<KString>. This is added mainly because lots of dbgln() statements generate Strings (such as absolute paths) which are only used for debugging. Instead of catching possible OOM situations at all the dbgln() callsites, this makes it possible to let the formatter code handle those situations by outputting "[out of memory]" if the OwnPtr is null.
2021-06-02Kernel: Add operator delete for KStringGunnar Beutner
This doesn't change anything because our global operator delete also calls kfree() - however instead of relying on this implementation detail this makes this dependency more explicit.
2021-06-02Kernel: Make KString non-copyable and non-movableGunnar Beutner
The user is supposed to hold these in an OwnPtr but bad things would happen if the user takes these out of the OwnPtr so let's make the class non-copyable and non-movable.
2021-05-31Kernel: Add KString::must_{..} factory methodsBrian Gianforcaro
There are a bunch of places like drivers which for all intense and purposes can't really fail allocation during boot, and if they do fail we should crash immediately. This change adds `KString::must_create_uninitialized(..)` as well as `KString::must_create(..)` for use during early boot initialization of the Kernel. They enforce that they are only used during early boot.
2021-05-28Kernel: Add KString, a single-owner string with OOM failure exposionAndreas Kling
This is a simple string class for use in the kernel. It encapsulates a length + character array in a single-allocation object. Main differences from AK::String: - Single-owner (no reference counting.) - Allocation failures are exposed, not hidden. The basic idea is to allow better and more precise string management in the kernel.