From e61860243329c57811aec28ed2eb0ff8c8af760f Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Thu, 21 Oct 2021 23:45:10 +0200 Subject: LibC: Implement mbrlen --- Userland/Libraries/LibC/wchar.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Userland') diff --git a/Userland/Libraries/LibC/wchar.cpp b/Userland/Libraries/LibC/wchar.cpp index b408e4fb71..d42c15cbf0 100644 --- a/Userland/Libraries/LibC/wchar.cpp +++ b/Userland/Libraries/LibC/wchar.cpp @@ -300,10 +300,14 @@ size_t mbrtowc(wchar_t* pwc, const char* s, size_t n, mbstate_t* state) return consumed_bytes; } -size_t mbrlen(const char*, size_t, mbstate_t*) +size_t mbrlen(const char* s, size_t n, mbstate_t* ps) { - dbgln("FIXME: Implement mbrlen()"); - TODO(); + static mbstate_t anonymous_state = {}; + + if (ps == nullptr) + ps = &anonymous_state; + + return mbrtowc(nullptr, s, n, ps); } size_t wcrtomb(char* s, wchar_t wc, mbstate_t*) -- cgit v1.2.3