string: add stubs for strcoll and strxfrm (TEST)

These extend the stub locale; strcoll is simply strcmp and strxfrm is
simply strncpy.
This commit is contained in:
Lephenixnoir 2021-05-23 18:06:57 +02:00
parent cda27ac2db
commit d105b1d60a
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
4 changed files with 21 additions and 3 deletions

View File

@ -139,6 +139,7 @@ set(SOURCES
src/libc/string/strchr.c
src/libc/string/strchrnul.c
src/libc/string/strcmp.c
src/libc/string/strcoll.c
src/libc/string/strcpy.c
src/libc/string/strcspn.c
src/libc/string/strdup.c
@ -150,7 +151,8 @@ set(SOURCES
src/libc/string/strndup.c
src/libc/string/strnlen.c
src/libc/string/strrchr.c
src/libc/string/strspn.c)
src/libc/string/strspn.c
src/libc/string/strxfrm.c)
if(vhex-generic IN_LIST TARGET_FOLDERS)
# TODO

4
STATUS
View File

@ -117,9 +117,9 @@ DONE: Function/symbol/macro is defined, builds, links, and is tested
7.21.3.2 strncat: DONE
7.21.4.1 memcmp: DONE
7.21.4.2 strcmp: DONE
! 7.21.4.3 strcoll: TODO
! 7.21.4.3 strcoll: TEST
7.21.4.4 strncmp: DONE
! 7.21.4.5 strxfrm: TODO
! 7.21.4.5 strxfrm: TEST
7.21.5.1 memchr: DONE
7.21.5.2 strchr: DONE
7.21.5.3 strcspn: DONE

View File

@ -0,0 +1,8 @@
#include <string.h>
#include <locale.h>
/* Stub locale: use strcmp. */
int strcoll(char const *s1, char const *s2)
{
return strcmp(s1, s2);
}

View File

@ -0,0 +1,8 @@
#include <string.h>
#include <locale.h>
size_t strxfrm(char * restrict dest, char const * restrict src, size_t n)
{
if(dest) strncpy(dest, src, n);
return strlen(src);
}