diff options
author | Freya Murphy <freya@freyacat.org> | 2025-04-03 12:30:34 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-04-03 12:30:34 -0400 |
commit | ec3c37d1d40d7b288584c234f4c3e7a600f2353d (patch) | |
tree | bb587b33c4c793ff7a3317dfa958d69b0fa318a1 /lib/strlen.c | |
parent | move boot only headers to boot (diff) | |
download | comus-ec3c37d1d40d7b288584c234f4c3e7a600f2353d.tar.gz comus-ec3c37d1d40d7b288584c234f4c3e7a600f2353d.tar.bz2 comus-ec3c37d1d40d7b288584c234f4c3e7a600f2353d.zip |
new libs
Diffstat (limited to 'lib/strlen.c')
-rw-r--r-- | lib/strlen.c | 34 |
1 files changed, 5 insertions, 29 deletions
diff --git a/lib/strlen.c b/lib/strlen.c index 4687a8a..6c4cc86 100644 --- a/lib/strlen.c +++ b/lib/strlen.c @@ -1,33 +1,9 @@ -/** -** @file strlen.c -** -** @author Numerous CSCI-452 classes -** -** @brief C implementations of common library functions -*/ +#include <string.h> -#ifndef STRLEN_SRC_INC -#define STRLEN_SRC_INC - -#include <common.h> - -#include <lib.h> - -/** -** strlen(str) - return length of a NUL-terminated string -** -** @param str The string to examine -** -** @return The length of the string, or 0 -*/ -uint32_t strlen(register const char *str) +size_t strlen(const char *str) { - register uint32_t len = 0; - - while (*str++) { - ++len; + const char *p; + for (p = str; *p != 0; p++) { } - - return (len); + return p - str; } -#endif |