2 * Copyright 2008 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
15 size_t strnlen(const char* string, size_t max);
17 size_t strnlen(const char* string, size_t max) {
18 const char* end = (const char*)memchr(string, '\0', max);
19 return end ? (size_t)(end - string) : max;