From 11ff194b97c0772c72d9e4c5c08c8b1390d6e8e6 Mon Sep 17 00:00:00 2001 From: Fredrik Holmqvist Date: Fri, 27 Apr 2012 22:15:48 +0200 Subject: [PATCH] Use strnlen instead of own impl, as it probably will have platform specific optimisation. --- src/kits/support/String.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/kits/support/String.cpp b/src/kits/support/String.cpp index 990100f7cc..d5b2c03838 100644 --- a/src/kits/support/String.cpp +++ b/src/kits/support/String.cpp @@ -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); }