Everywhere: Remove unused includes of LibC/stdlib.h

These instances were detected by searching for files that include
stdlib.h, but don't match the regex:

\\b(_abort|abort|abs|aligned_alloc|arc4random|arc4random_buf|arc4random_
uniform|atexit|atof|atoi|atol|atoll|bsearch|calloc|clearenv|div|div_t|ex
it|_Exit|EXIT_FAILURE|EXIT_SUCCESS|free|getenv|getprogname|grantpt|labs|
ldiv|ldiv_t|llabs|lldiv|lldiv_t|malloc|malloc_good_size|malloc_size|mble
n|mbstowcs|mbtowc|mkdtemp|mkstemp|mkstemps|mktemp|posix_memalign|posix_o
penpt|ptsname|ptsname_r|putenv|qsort|qsort_r|rand|RAND_MAX|random|reallo
c|realpath|secure_getenv|serenity_dump_malloc_stats|serenity_setenv|sete
nv|setprogname|srand|srandom|strtod|strtof|strtol|strtold|strtoll|strtou
l|strtoull|system|unlockpt|unsetenv|wcstombs|wctomb)\\b

(Without the linebreaks.)

This regex is pessimistic, so there might be more files that don't
actually use anything from the stdlib.

In theory, one might use LibCPP to detect things like this
automatically, but let's do this one step after another.
This commit is contained in:
Ben Wiederhake 2023-01-02 16:57:12 +01:00 committed by Tim Flynn
parent f07847e099
commit 6b7ce19161
Notes: sideshowbarker 2024-07-17 02:16:24 +09:00
39 changed files with 0 additions and 39 deletions

View file

@ -12,7 +12,6 @@
#if defined(KERNEL) #if defined(KERNEL)
# include <Kernel/StdLib.h> # include <Kernel/StdLib.h>
#else #else
# include <stdlib.h>
# include <string.h> # include <string.h>
#endif #endif

View file

@ -11,7 +11,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/stat.h> #include <sys/stat.h>

View file

@ -8,7 +8,6 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <unistd.h> #include <unistd.h>
int main(int, char**) int main(int, char**)

View file

@ -11,7 +11,6 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <utime.h> #include <utime.h>

View file

@ -8,7 +8,6 @@
#include <AK/Array.h> #include <AK/Array.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
typedef long double longdouble; typedef long double longdouble;

View file

@ -18,7 +18,6 @@
#include <LibGfx/PPMLoader.h> #include <LibGfx/PPMLoader.h>
#include <LibTest/TestCase.h> #include <LibTest/TestCase.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
TEST_CASE(test_bmp) TEST_CASE(test_bmp)

View file

@ -8,7 +8,6 @@
#include <LibCore/ArgsParser.h> #include <LibCore/ArgsParser.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h> #include <sys/mman.h>
static void write8(void* ptr) { *(uint8_t volatile*)ptr = 1; } static void write8(void* ptr) { *(uint8_t volatile*)ptr = 1; }

View file

@ -16,7 +16,6 @@
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGfx/Font/FontDatabase.h> #include <LibGfx/Font/FontDatabase.h>
#include <LibGfx/StylePainter.h> #include <LibGfx/StylePainter.h>
#include <stdlib.h>
REGISTER_WIDGET(SystemMonitor, MemoryStatsWidget) REGISTER_WIDGET(SystemMonitor, MemoryStatsWidget)

View file

@ -21,7 +21,6 @@
#include <LibGfx/Vector3.h> #include <LibGfx/Vector3.h>
#include <LibMain/Main.h> #include <LibMain/Main.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <unistd.h> #include <unistd.h>
int const WIDTH = 200; int const WIDTH = 200;

View file

@ -8,7 +8,6 @@
#include "RemoteObject.h" #include "RemoteObject.h"
#include "RemoteObjectGraphModel.h" #include "RemoteObjectGraphModel.h"
#include "RemoteObjectPropertyModel.h" #include "RemoteObjectPropertyModel.h"
#include <stdlib.h>
namespace Inspector { namespace Inspector {

View file

@ -7,7 +7,6 @@
#include <AK/Types.h> #include <AK/Types.h>
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <sys/internals.h> #include <sys/internals.h>
#include <unistd.h> #include <unistd.h>

View file

@ -6,7 +6,6 @@
#include <AK/ScopeGuard.h> #include <AK/ScopeGuard.h>
#include <AK/StringView.h> #include <AK/StringView.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>

View file

@ -12,7 +12,6 @@
#include <errno_codes.h> #include <errno_codes.h>
#include <grp.h> #include <grp.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>

View file

@ -20,7 +20,6 @@
#include <fenv.h> #include <fenv.h>
#include <math.h> #include <math.h>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h>
#if defined(AK_COMPILER_CLANG) #if defined(AK_COMPILER_CLANG)
# pragma clang diagnostic push # pragma clang diagnostic push

View file

@ -11,7 +11,6 @@
#include <errno.h> #include <errno.h>
#include <pwd.h> #include <pwd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>

View file

@ -11,7 +11,6 @@
#include <errno.h> #include <errno.h>
#include <shadow.h> #include <shadow.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>

View file

@ -18,7 +18,6 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>

View file

@ -15,7 +15,6 @@
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/times.h> #include <sys/times.h>

View file

@ -8,7 +8,6 @@
#include <LibCore/GetPassword.h> #include <LibCore/GetPassword.h>
#include <LibCore/System.h> #include <LibCore/System.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <termios.h> #include <termios.h>
#include <unistd.h> #include <unistd.h>

View file

@ -12,7 +12,6 @@
#include <AK/MemoryStream.h> #include <AK/MemoryStream.h>
#include <AK/StringBuilder.h> #include <AK/StringBuilder.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <stdlib.h>
namespace DNS { namespace DNS {

View file

@ -10,7 +10,6 @@
#include <LaunchServer/LaunchServerEndpoint.h> #include <LaunchServer/LaunchServerEndpoint.h>
#include <LibDesktop/Launcher.h> #include <LibDesktop/Launcher.h>
#include <LibIPC/ConnectionToServer.h> #include <LibIPC/ConnectionToServer.h>
#include <stdlib.h>
namespace Desktop { namespace Desktop {

View file

@ -25,7 +25,6 @@
#include <LibGUI/Toolbar.h> #include <LibGUI/Toolbar.h>
#include <LibGfx/Bitmap.h> #include <LibGfx/Bitmap.h>
#include <LibGfx/Font/Emoji.h> #include <LibGfx/Font/Emoji.h>
#include <stdlib.h>
namespace GUI { namespace GUI {

View file

@ -14,7 +14,6 @@
#include <LibIPC/Decoder.h> #include <LibIPC/Decoder.h>
#include <LibIPC/Encoder.h> #include <LibIPC/Encoder.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h>
namespace Gfx { namespace Gfx {

View file

@ -15,7 +15,6 @@
#include <LibGfx/Font/OpenType/Font.h> #include <LibGfx/Font/OpenType/Font.h>
#include <LibGfx/Font/Typeface.h> #include <LibGfx/Font/Typeface.h>
#include <LibGfx/Font/WOFF/Font.h> #include <LibGfx/Font/WOFF/Font.h>
#include <stdlib.h>
namespace Gfx { namespace Gfx {

View file

@ -12,7 +12,6 @@
#include <LibGfx/Forward.h> #include <LibGfx/Forward.h>
#include <LibGfx/Point.h> #include <LibGfx/Point.h>
#include <LibGfx/Rect.h> #include <LibGfx/Rect.h>
#include <stdlib.h>
namespace Gfx { namespace Gfx {

View file

@ -20,7 +20,6 @@
#include <errno.h> #include <errno.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>

View file

@ -24,7 +24,6 @@
#include <LibJS/Runtime/Temporal/PlainTime.h> #include <LibJS/Runtime/Temporal/PlainTime.h>
#include <LibJS/Runtime/Temporal/TimeZone.h> #include <LibJS/Runtime/Temporal/TimeZone.h>
#include <LibJS/Runtime/Temporal/ZonedDateTime.h> #include <LibJS/Runtime/Temporal/ZonedDateTime.h>
#include <stdlib.h>
namespace JS::Temporal { namespace JS::Temporal {

View file

@ -10,7 +10,6 @@
#include <AK/Types.h> #include <AK/Types.h>
#include <AK/Utf8View.h> #include <AK/Utf8View.h>
#include <AK/Vector.h> #include <AK/Vector.h>
#include <stdlib.h>
namespace Line { namespace Line {

View file

@ -10,7 +10,6 @@
#include <AK/Forward.h> #include <AK/Forward.h>
#include <LibLine/StringMetrics.h> #include <LibLine/StringMetrics.h>
#include <LibLine/SuggestionManager.h> #include <LibLine/SuggestionManager.h>
#include <stdlib.h>
namespace Line { namespace Line {

View file

@ -11,7 +11,6 @@
#include <AK/Utf32View.h> #include <AK/Utf32View.h>
#include <AK/Utf8View.h> #include <AK/Utf8View.h>
#include <LibLine/Style.h> #include <LibLine/Style.h>
#include <stdlib.h>
namespace Line { namespace Line {

View file

@ -34,7 +34,6 @@
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <unistd.h> #include <unistd.h>

View file

@ -11,7 +11,6 @@
#include <LibWeb/Layout/BlockContainer.h> #include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/Node.h> #include <LibWeb/Layout/Node.h>
#include <LibWeb/Layout/Progress.h> #include <LibWeb/Layout/Progress.h>
#include <stdlib.h>
namespace Web::HTML { namespace Web::HTML {

View file

@ -15,7 +15,6 @@
#include <LibCore/ConfigFile.h> #include <LibCore/ConfigFile.h>
#include <LibCore/Timer.h> #include <LibCore/Timer.h>
#include <pthread.h> #include <pthread.h>
#include <stdlib.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
namespace AudioServer { namespace AudioServer {

View file

@ -7,7 +7,6 @@
#include <AK/Format.h> #include <AK/Format.h>
#include <LibCore/System.h> #include <LibCore/System.h>
#include <LibMain/Main.h> #include <LibMain/Main.h>
#include <stdlib.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>

View file

@ -16,7 +16,6 @@
#include <netdb.h> #include <netdb.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/select.h> #include <sys/select.h>
#include <sys/socket.h> #include <sys/socket.h>

View file

@ -10,7 +10,6 @@
#include <LibCore/System.h> #include <LibCore/System.h>
#include <LibMain/Main.h> #include <LibMain/Main.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>

View file

@ -14,7 +14,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/stat.h> #include <sys/stat.h>

View file

@ -12,7 +12,6 @@
#include <LibCore/Stream.h> #include <LibCore/Stream.h>
#include <LibCore/System.h> #include <LibCore/System.h>
#include <LibMain/Main.h> #include <LibMain/Main.h>
#include <stdlib.h>
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)
{ {

View file

@ -20,7 +20,6 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.h> #include <sys/mman.h>