AK: Make the return type of dbgputstr consistent.

This commit is contained in:
asynts 2020-10-04 17:42:31 +02:00 committed by Andreas Kling
parent 4cf3a1eb41
commit 59e7ffa86d
Notes: sideshowbarker 2024-07-19 02:04:12 +09:00
5 changed files with 9 additions and 6 deletions

View File

@ -585,7 +585,7 @@ void vwarn(StringView fmtstr, TypeErasedFormatParams params, bool newline)
void raw_dbg(StringView string) void raw_dbg(StringView string)
{ {
const auto retval = dbgputstr(string.characters_without_null_termination(), string.length()); const auto retval = dbgputstr(string.characters_without_null_termination(), string.length());
ASSERT(static_cast<size_t>(retval) == string.length()); ASSERT(retval == 0);
} }
void vdbg(StringView fmtstr, TypeErasedFormatParams params, bool newline) void vdbg(StringView fmtstr, TypeErasedFormatParams params, bool newline)
{ {

View File

@ -35,7 +35,7 @@
extern "C" { extern "C" {
int vdbgprintf(const char* fmt, va_list); int vdbgprintf(const char* fmt, va_list);
int dbgprintf(const char* fmt, ...); int dbgprintf(const char* fmt, ...);
ssize_t dbgputstr(const char*, ssize_t); int dbgputstr(const char*, ssize_t);
int sprintf(char* buf, const char* fmt, ...); int sprintf(char* buf, const char* fmt, ...);
int snprintf(char* buffer, size_t, const char* fmt, ...); int snprintf(char* buffer, size_t, const char* fmt, ...);
} }
@ -44,9 +44,10 @@ int snprintf(char* buffer, size_t, const char* fmt, ...);
# include <stdio.h> # include <stdio.h>
# define kprintf printf # define kprintf printf
# define dbgprintf(...) fprintf(stderr, __VA_ARGS__) # define dbgprintf(...) fprintf(stderr, __VA_ARGS__)
inline size_t dbgputstr(const char* characters, ssize_t length) inline int dbgputstr(const char* characters, ssize_t length)
{ {
return fwrite(characters, 1, length, stderr); fwrite(characters, 1, length, stderr);
return 0;
} }
#endif #endif
template<size_t N> template<size_t N>

View File

@ -193,6 +193,8 @@ int main(int argc, char** argv)
new_tab.load(url); new_tab.load(url);
dbgln("Added new tab {:p}, loading {}", &new_tab, url);
if (activate) if (activate)
tab_widget.set_active_widget(&new_tab); tab_widget.set_active_widget(&new_tab);
}; };

View File

@ -1044,7 +1044,7 @@ void dbgputch(char ch)
syscall(SC_dbgputch, ch); syscall(SC_dbgputch, ch);
} }
ssize_t dbgputstr(const char* characters, ssize_t length) int dbgputstr(const char* characters, ssize_t length)
{ {
int rc = syscall(SC_dbgputstr, characters, length); int rc = syscall(SC_dbgputstr, characters, length);
__RETURN_WITH_ERRNO(rc, rc, -1); __RETURN_WITH_ERRNO(rc, rc, -1);

View File

@ -93,7 +93,7 @@ int fprintf(FILE*, const char* fmt, ...);
int printf(const char* fmt, ...); int printf(const char* fmt, ...);
int dbgprintf(const char* fmt, ...); int dbgprintf(const char* fmt, ...);
void dbgputch(char); void dbgputch(char);
ssize_t dbgputstr(const char*, ssize_t); int dbgputstr(const char*, ssize_t);
int sprintf(char* buffer, const char* fmt, ...); int sprintf(char* buffer, const char* fmt, ...);
int snprintf(char* buffer, size_t, const char* fmt, ...); int snprintf(char* buffer, size_t, const char* fmt, ...);
int putchar(int ch); int putchar(int ch);