Use strnlen instead of own impl, as it probably will have platform specific optimisation.
This commit is contained in:
parent
258d4ef93d
commit
11ff194b97
@ -56,11 +56,7 @@ static inline int32
|
|||||||
strlen_clamp(const char* str, int32 max)
|
strlen_clamp(const char* str, int32 max)
|
||||||
{
|
{
|
||||||
// this should yield 0 for max<0:
|
// this should yield 0 for max<0:
|
||||||
int32 length = 0;
|
return max <= 0 ? 0 : strnlen(str, max);
|
||||||
while (length < max && *str++) {
|
|
||||||
length++;
|
|
||||||
}
|
|
||||||
return length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user