[SDK] Minor improvements to CRT, RTL, and headers

Signed-off-by: Quinn Stephens <quinn@osmora.org>
This commit is contained in:
2024-11-16 07:10:11 -05:00
parent e81100b2e5
commit e3f81a4c08
13 changed files with 231 additions and 224 deletions

View File

@@ -24,9 +24,11 @@ strlen (
const char *ptr;
ptr = str;
while (*ptr++);
while (*ptr) {
ptr++;
}
return ptr - str - sizeof(char);
return ptr - str;
}
size_t
@@ -36,12 +38,14 @@ strnlen (
)
{
size_t len;
const char *ptr;
len = 0;
while (len < maxlen && str[len++]);
ptr = str;
while (maxlen-- && *ptr) {
ptr++;
}
return len - sizeof(char);
return ptr - str;
}
int