mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 06:47:34 +00:00
AK: Return KString instead of String from encode_hex in the Kernel
This let's us propagate allocation errors from this API.
This commit is contained in:
parent
d296001f3f
commit
3219ce3d61
3 changed files with 32 additions and 6 deletions
11
AK/Hex.h
11
AK/Hex.h
|
@ -8,9 +8,14 @@
|
|||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Error.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
|
||||
#ifdef KERNEL
|
||||
# include <Kernel/KString.h>
|
||||
#else
|
||||
# include <AK/String.h>
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
|
||||
constexpr u8 decode_hex_digit(char digit)
|
||||
|
@ -26,7 +31,11 @@ constexpr u8 decode_hex_digit(char digit)
|
|||
|
||||
ErrorOr<ByteBuffer> decode_hex(StringView);
|
||||
|
||||
#ifdef KERNEL
|
||||
ErrorOr<NonnullOwnPtr<Kernel::KString>> encode_hex(ReadonlyBytes);
|
||||
#else
|
||||
String encode_hex(ReadonlyBytes);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue