PatchworkOS
Loading...
Searching...
No Matches
strnlen_s.c
Go to the documentation of this file.
1#include <stdint.h>
2#include <string.h>
3
4size_t strnlen_s(const char* s, size_t maxsize)
5{
6 if (s == NULL)
7 {
8 return 0;
9 }
10
11 for (uint64_t i = 0; i < maxsize; i++)
12 {
13 if (s[i] == '\0')
14 {
15 return i;
16 }
17 }
18
19 return maxsize;
20}
#define NULL
Pointer error value.
Definition NULL.h:23
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
size_t strnlen_s(const char *s, size_t maxsize)
Definition strnlen_s.c:4