]> pd.if.org Git - pdclib.old/commitdiff
PDCLIB-2 Add strlen() variant for char16_t/char32_t strings
authorOwen Shepherd <owen.shepherd@e43.eu>
Mon, 31 Dec 2012 20:30:20 +0000 (20:30 +0000)
committerOwen Shepherd <owen.shepherd@e43.eu>
Mon, 31 Dec 2012 20:30:20 +0000 (20:30 +0000)
functions/uchar/_PDCLIB_c16slen.c [new file with mode: 0644]
functions/uchar/_PDCLIB_c32slen.c [new file with mode: 0644]

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
diff --git a/functions/uchar/_PDCLIB_c32slen.c b/functions/uchar/_PDCLIB_c32slen.c
new file mode 100644 (file)
index 0000000..ac15c0c
--- /dev/null
@@ -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 <uchar.h>
+
+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