From 0694aac9fb1190feaa4fb3ff6d55175e0ac48e52 Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Mon, 31 Dec 2012 20:30:20 +0000 Subject: [PATCH] PDCLIB-2 Add strlen() variant for char16_t/char32_t strings --- functions/uchar/_PDCLIB_c16slen.c | 28 ++++++++++++++++++++++++++++ functions/uchar/_PDCLIB_c32slen.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 functions/uchar/_PDCLIB_c16slen.c create mode 100644 functions/uchar/_PDCLIB_c32slen.c 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 -- 2.40.0