From: Owen Shepherd Date: Mon, 31 Dec 2012 20:30:20 +0000 (+0000) Subject: PDCLIB-2 Add strlen() variant for char16_t/char32_t strings X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=commitdiff_plain;h=0694aac9fb1190feaa4fb3ff6d55175e0ac48e52 PDCLIB-2 Add strlen() variant for char16_t/char32_t strings --- diff --git a/functions/uchar/_PDCLIB_c16slen.c b/functions/uchar/_PDCLIB_c16slen.c new file mode 100644 index 0000000..6652b3a --- /dev/null +++ b/functions/uchar/_PDCLIB_c16slen.c @@ -0,0 +1,28 @@ +/* _PDCLIB_c16slen( const char16_t * ); + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#ifndef REGTEST +#include + +size_t _PDCLIB_c16slen( const char16_t * str ) +{ + size_t n = 0; + while(*(str++)) n++; + return n; +} + + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + return TEST_RESULTS; +} + +#endif diff --git a/functions/uchar/_PDCLIB_c32slen.c b/functions/uchar/_PDCLIB_c32slen.c new file mode 100644 index 0000000..ac15c0c --- /dev/null +++ b/functions/uchar/_PDCLIB_c32slen.c @@ -0,0 +1,28 @@ +/* _PDCLIB_c32slen( const char32_t * ); + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#ifndef REGTEST +#include + +size_t _PDCLIB_c32slen( const char32_t * str ) +{ + size_t n = 0; + while(*(str++)) n++; + return n; +} + + +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +int main( void ) +{ + return TEST_RESULTS; +} + +#endif