Debian Codegraph @

stdlib/strnlen.c

raw
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /* Copyright 1996-2016 The NASM Authors - All Rights Reserved */
3
4 #include "compiler.h"
5
6 #ifndef HAVE_STRNLEN
7
8 size_t strnlen(const char *s, size_t maxlen)
9 {
10 const char *end = memchr(s, 0, maxlen);
11
12 return end ? (size_t)(end - s) : maxlen;
13 }
14
15 #endif