From c5a867d81cc6602e6637588abc288f8f94ad2224 Mon Sep 17 00:00:00 2001 From: apio Date: Fri, 28 Apr 2023 20:00:26 +0200 Subject: [PATCH] libluna: Add wcscmp --- libluna/include/luna/CString.h | 1 + libluna/src/CString.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/libluna/include/luna/CString.h b/libluna/include/luna/CString.h index ef53d3ba..0ea31182 100644 --- a/libluna/include/luna/CString.h +++ b/libluna/include/luna/CString.h @@ -20,6 +20,7 @@ extern "C" char* strtok(char* str, const char* delim); usize wcslen(const wchar_t* str); + int wcscmp(const wchar_t* a, const wchar_t* b); char* strdup(const char* str); char* strndup(const char* str, usize max); diff --git a/libluna/src/CString.cpp b/libluna/src/CString.cpp index eb96c129..7abd0f10 100644 --- a/libluna/src/CString.cpp +++ b/libluna/src/CString.cpp @@ -64,6 +64,16 @@ extern "C" return *(const u8*)a - *(const u8*)b; } + int wcscmp(const wchar_t* a, const wchar_t* b) + { + while (*a && (*a == *b)) + { + a++; + b++; + } + return *(const u8*)a - *(const u8*)b; + } + int strncmp(const char* a, const char* b, usize max) { const char* s = a;