| OLD | NEW |
| (Empty) |
| 1 /* | |
| 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. | |
| 5 */ | |
| 6 | |
| 7 | |
| 8 #include <sys/stat.h> | |
| 9 #include <sys/types.h> | |
| 10 | |
| 11 #include <fcntl.h> | |
| 12 #include <string.h> | |
| 13 #include <unistd.h> | |
| 14 | |
| 15 size_t strnlen(const char* string, size_t max); | |
| 16 | |
| 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; | |
| 20 } | |
| OLD | NEW |