Root/
Source at commit 1406 created 12 years 10 months ago. By meklort, Revert drivers.c so that kexts are only loaded when OSBundleRequired is set and that value is not safe mode. Added some comments about it too. | |
---|---|
1 | /*␊ |
2 | * strlcpy.c␊ |
3 | */␊ |
4 | ␊ |
5 | #include <string.h>␊ |
6 | ␊ |
7 | size_t strlcpy(char *dst, const char *src, size_t size)␊ |
8 | {␊ |
9 | ␉size_t bytes = 0;␊ |
10 | ␉char *q = dst;␊ |
11 | ␉const char *p = src;␊ |
12 | ␉char ch;␊ |
13 | ␊ |
14 | ␉while ((ch = *p++)) {␊ |
15 | ␉␉if (bytes + 1 < size)␊ |
16 | ␉␉␉*q++ = ch;␊ |
17 | ␊ |
18 | ␉␉bytes++;␊ |
19 | ␉}␊ |
20 | ␊ |
21 | ␉/* If size == 0 there is no space for a final null... */␊ |
22 | ␉if (size)␊ |
23 | ␉␉*q = '\0';␊ |
24 | ␊ |
25 | ␉return bytes;␊ |
26 | }␊ |
27 |