1 /*
2 * Copyright (C) 1991, 1992 Linus Torvalds
3 */
4
5 #include <xen/string.h>
6
7 /**
8 * strnlen - Find the length of a length-limited string
9 * @s: The string to be sized
10 * @count: The maximum number of bytes to search
11 */
strnlen(const char * s,size_t count)12 size_t strnlen(const char * s, size_t count)
13 {
14 const char *sc;
15
16 for (sc = s; count-- && *sc != '\0'; ++sc)
17 /* nothing */;
18 return sc - s;
19 }
20
21 /*
22 * Local variables:
23 * mode: C
24 * c-file-style: "BSD"
25 * c-basic-offset: 8
26 * tab-width: 8
27 * indent-tabs-mode: t
28 * End:
29 */
30