From 433b307cb2781ded6ff3980c5d7bade628a57cce Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 22 Oct 2022 21:00:59 +0200 Subject: [PATCH] libc: Add strcoll() No locale support, this just calls strcmp() --- libs/libc/include/string.h | 3 +++ libs/libc/src/string.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/libs/libc/include/string.h b/libs/libc/include/string.h index 7dd597c5..88e133b2 100644 --- a/libs/libc/include/string.h +++ b/libs/libc/include/string.h @@ -71,6 +71,9 @@ extern "C" /* Compares at most max bytes of the strings a and b. */ int strncmp(const char* a, const char* b, size_t max); + /* Compares a and b based on the current locale. */ + int strcoll(const char* a, const char* b); + /* Searches for the needle string in the haystack string. */ char* strstr(const char* haystack, const char* needle); diff --git a/libs/libc/src/string.cpp b/libs/libc/src/string.cpp index f07ff7b5..7ba70640 100644 --- a/libs/libc/src/string.cpp +++ b/libs/libc/src/string.cpp @@ -131,6 +131,11 @@ extern "C" return *(const unsigned char*)a - *(const unsigned char*)b; } + int strcoll(const char* a, const char* b) + { + return strcmp(a, b); + } + size_t strcspn(const char* str, const char* reject) { const char* s = str;