scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit d5ba8097fd91eed96b9d754fbef73bced676f833
parent 41c9715c496b8b7b27400d387388f472dcacc583
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 28 Apr 2020 08:26:30 +0200

libc: Remove strnlen()

Strlen() is a POSIX function and it is not defined in C99.

Diffstat:
Minclude/string.h | 1-
Msrc/libc/string/Makefile | 1-
Dsrc/libc/string/strnlen.c | 13-------------
3 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/include/string.h b/include/string.h @@ -29,6 +29,5 @@ extern char *strtok(char * restrict s1, const char * restrict s2); extern void *memset(void *s, int c, size_t n); extern char *strerror(int errnum); extern size_t strlen(const char *s); -extern size_t strnlen(const char *s, size_t maxlen); #endif diff --git a/src/libc/string/Makefile b/src/libc/string/Makefile @@ -15,7 +15,6 @@ OBJS = \ strncat.$O\ strncmp.$O\ strncpy.$O\ - strnlen.$O\ strpbrk.$O\ strrchr.$O\ strspn.$O\ diff --git a/src/libc/string/strnlen.c b/src/libc/string/strnlen.c @@ -1,13 +0,0 @@ -#include <string.h> - -#undef strnlen - -size_t -strnlen(const char *s, size_t maxlen) -{ - size_t n; - - for (n = 0; n < maxlen && *s++; ++n) - ; - return n; -}