From 9c1c6bb3205dca4f1776f0e95e42188e4d4efcd1 Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 18 Dec 2022 14:33:13 +0100 Subject: [PATCH] Add wcslen() I think this can go in CString.h, no need to create a separate CWChar.h or something --- luna/include/luna/CString.h | 2 ++ luna/src/CString.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/luna/include/luna/CString.h b/luna/include/luna/CString.h index 0eca451c..b1026be3 100644 --- a/luna/include/luna/CString.h +++ b/luna/include/luna/CString.h @@ -9,5 +9,7 @@ extern "C" void* memmove(void* dest, const void* src, usize n); usize strlen(const char* str); + usize wcslen(const wchar_t* str); + char* strdup(const char* str); } \ No newline at end of file diff --git a/luna/src/CString.cpp b/luna/src/CString.cpp index 7942501a..79580e6f 100644 --- a/luna/src/CString.cpp +++ b/luna/src/CString.cpp @@ -46,6 +46,14 @@ extern "C" return (usize)(i - str); } + usize wcslen(const wchar_t* str) + { + const wchar_t* i = str; + for (; *i; ++i) + ; + return (usize)(i - str); + } + char* strdup(const char* str) { const usize len = strlen(str);