]> pd.if.org Git - pdclib/blobdiff - functions/string/strlen.c
Reviewed.
[pdclib] / functions / string / strlen.c
index 9dfc38fed0a058172142e2441820e6b2aaffa1c0..ec0c21e7134a8c96edbac8b28d353c2592b1abdf 100644 (file)
@@ -5,25 +5,14 @@
 // This code is Public Domain. Use, modify, and redistribute at will.
 // ----------------------------------------------------------------------------
 
-size_t strlen( const char * s ) { /* TODO */ };
+#include <__size_t.h>
 
-/* Therx code
+size_t strlen( const char * src )
 {
-    const char * start = s1;
-    while (*s1)
+    size_t len = 0;
+    while ( src[len] != '\0' )
     {
-        s1++;
+        ++len;
     }
-    return s1 - start;
+    return len;
 }
-*/
-
-/* PDPC code - unreviewed
-{
-    const char *p;
-    
-    p = s;
-    while (*p != '\0') p++;
-    return ((size_t)(p - s));
-}
-*/