about summary refs log tree commit diff
path: root/src/string/strnlen.c
blob: 6442eb793fbeeda51a3f19b9e1c1269a030444e9 (plain) (blame)
1
2
3
4
5
6
7
#include <string.h>

size_t strnlen(const char *s, size_t n)
{
	const char *p = memchr(s, 0, n);
	return p ? p-s : n;
}