AK: Remove kstdio.h and dbgputstr()

We can just write directly to stderr in the one place this was used.
This commit is contained in:
Andreas Kling 2024-06-18 09:42:01 +02:00 committed by Andreas Kling
parent 6df5785fc4
commit 47287d2cf1
Notes: sideshowbarker 2024-07-17 04:32:07 +09:00
3 changed files with 1 additions and 33 deletions

View file

@ -12,7 +12,6 @@
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/StringFloatingPointConversions.h>
#include <AK/kstdio.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
@ -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
}

View file

@ -1,30 +0,0 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Platform.h>
#ifdef AK_OS_SERENITY
# include <AK/Types.h>
# include <stdarg.h>
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 <stdio.h>
inline void dbgputstr(char const* characters, size_t length)
{
fwrite(characters, 1, length, stderr);
}
#endif
template<size_t N>
inline void dbgputstr(char const (&array)[N])
{
return ::dbgputstr(array, N);
}

View file

@ -209,7 +209,6 @@ shared_library("AK") {
"Weakable.h",
"kmalloc.cpp",
"kmalloc.h",
"kstdio.h",
]
}