From 47287d2cf1b8dcde6347fe70ab0c2b5645467e58 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 18 Jun 2024 09:42:01 +0200 Subject: [PATCH] AK: Remove kstdio.h and dbgputstr() We can just write directly to stderr in the one place this was used. --- AK/Format.cpp | 3 +-- AK/kstdio.h | 30 ------------------------------ Meta/gn/secondary/AK/BUILD.gn | 1 - 3 files changed, 1 insertion(+), 33 deletions(-) delete mode 100644 AK/kstdio.h diff --git a/AK/Format.cpp b/AK/Format.cpp index 181398145af..f8083a5ff59 100644 --- a/AK/Format.cpp +++ b/AK/Format.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -1210,7 +1209,7 @@ void vdbg(StringView fmtstr, TypeErasedFormatParams& params, bool newline) #ifdef AK_OS_ANDROID __android_log_write(ANDROID_LOG_DEBUG, s_log_tag_name, string.characters_without_null_termination()); #else - dbgputstr(string.characters_without_null_termination(), string.length()); + [[maybe_unused]] auto rc = write(STDERR_FILENO, string.characters_without_null_termination(), string.length()); #endif } diff --git a/AK/kstdio.h b/AK/kstdio.h deleted file mode 100644 index 6d8478b5440..00000000000 --- a/AK/kstdio.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2018-2020, Andreas Kling - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include - -#ifdef AK_OS_SERENITY -# include -# include -extern "C" { -void dbgputstr(char const*, size_t); -int sprintf(char* buf, char const* fmt, ...) __attribute__((format(printf, 2, 3))); -int snprintf(char* buffer, size_t, char const* fmt, ...) __attribute__((format(printf, 3, 4))); -} -#else -# include -inline void dbgputstr(char const* characters, size_t length) -{ - fwrite(characters, 1, length, stderr); -} -#endif -template -inline void dbgputstr(char const (&array)[N]) -{ - return ::dbgputstr(array, N); -} diff --git a/Meta/gn/secondary/AK/BUILD.gn b/Meta/gn/secondary/AK/BUILD.gn index 96099f0bb2f..ab357a9ca32 100644 --- a/Meta/gn/secondary/AK/BUILD.gn +++ b/Meta/gn/secondary/AK/BUILD.gn @@ -209,7 +209,6 @@ shared_library("AK") { "Weakable.h", "kmalloc.cpp", "kmalloc.h", - "kstdio.h", ] }