Browse Source

string: add stubs for strcoll and strxfrm (TEST)

These extend the stub locale; strcoll is simply strcmp and strxfrm is
simply strncpy.
master
Lephenixnoir 8 months ago
parent
commit
d105b1d60a
Signed by: Lephenixnoir GPG Key ID: 1BBA026E13FC0495
  1. 4
      CMakeLists.txt
  2. 4
      STATUS
  3. 8
      src/libc/string/strcoll.c
  4. 8
      src/libc/string/strxfrm.c

4
CMakeLists.txt

@ -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

@ -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

8
src/libc/string/strcoll.c

@ -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);
}

8
src/libc/string/strxfrm.c

@ -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);
}
Loading…
Cancel
Save