1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:57:47 +00:00

Everywhere: Remove string.h include from AK/Traits.h and resolve fallout

A lot of places were relying on AK/Traits.h to give it strnlen, memcmp,
memcpy and other related declarations.

In the quest to remove inclusion of LibC headers from Kernel files, deal
with all the fallout of this included-everywhere header including less
things.
This commit is contained in:
Andrew Kaster 2023-01-07 13:57:33 -07:00 committed by Andrew Kaster
parent 0420736143
commit 7ab37ee22c
14 changed files with 35 additions and 18 deletions

View file

@ -6,6 +6,7 @@
#include <AK/CharacterTypes.h>
#include <AK/FuzzyMatch.h>
#include <string.h>
namespace AK {

View file

@ -84,11 +84,11 @@ public:
TRY(begin_item(key));
if constexpr (IsLegacyBuilder<Builder>) {
TRY(m_builder.try_append('"'));
TRY(m_builder.try_append_escaped_for_json({ value, strlen(value) }));
TRY(m_builder.try_append_escaped_for_json({ value, __builtin_strlen(value) }));
TRY(m_builder.try_append('"'));
} else {
TRY(m_builder.append('"'));
TRY(m_builder.append_escaped_for_json({ value, strlen(value) }));
TRY(m_builder.append_escaped_for_json({ value, __builtin_strlen(value) }));
TRY(m_builder.append('"'));
}
return {};

View file

@ -10,10 +10,10 @@
#include <AK/StdLibExtras.h>
#include <AK/Types.h>
#include <stdarg.h>
#include <wchar.h>
#ifndef KERNEL
# include <math.h>
# include <wchar.h>
#endif
#ifdef AK_OS_SERENITY

View file

@ -14,9 +14,12 @@
#include <AK/StringView.h>
#include <AK/Vector.h>
#ifndef KERNEL
#ifdef KERNEL
# include <Kernel/StdLib.h>
#else
# include <AK/DeprecatedString.h>
# include <AK/FloatingPointStringConversions.h>
# include <string.h>
#endif
namespace AK {

View file

@ -11,12 +11,11 @@
#include <AK/Platform.h>
#include <AK/Types.h>
// Kernel and Userspace pull in the definitions from different places.
// Avoid trying to figure out which one.
struct timeval;
struct timespec;
#if defined(AK_OS_WINDOWS)
#if defined(AK_OS_SERENITY) && defined(KERNEL)
# include <Kernel/API/POSIX/sys/time.h>
# include <Kernel/API/POSIX/time.h>
#else
# include <sys/time.h>
# include <time.h>
#endif

View file

@ -11,7 +11,6 @@
#include <AK/Forward.h>
#include <AK/HashFunctions.h>
#include <AK/StringHash.h>
#include <string.h>
namespace AK {