Use strnlen instead of own impl, as it probably will have platform specific optimisation.

This commit is contained in:
Fredrik Holmqvist 2012-04-27 22:15:48 +02:00
parent 258d4ef93d
commit 11ff194b97

View File

@ -56,11 +56,7 @@ static inline int32
strlen_clamp(const char* str, int32 max)
{
// this should yield 0 for max<0:
int32 length = 0;
while (length < max && *str++) {
length++;
}
return length;
return max <= 0 ? 0 : strnlen(str, max);
}