]> pd.if.org Git - pdclib/blobdiff - functions/uchar/_PDCLIB_c16slen.c
PDCLIB-2 Add strlen() variant for char16_t/char32_t strings
[pdclib] / functions / uchar / _PDCLIB_c16slen.c
diff --git a/functions/uchar/_PDCLIB_c16slen.c b/functions/uchar/_PDCLIB_c16slen.c
new file mode 100644 (file)
index 0000000..6652b3a
--- /dev/null
@@ -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 <uchar.h>
+
+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