[prev in list] [next in list] [prev in thread] [next in thread]
List: haiku-commits
Subject: [haiku-commits] haiku: hrev44072 - src/kits/support
From: fredrik.holmqvist () gmail ! com
Date: 2012-04-27 20:54:51
Message-ID: 20120427205451.7B5F45C05FD () vmrepo ! haiku-os ! org
[Download RAW message or body]
hrev44072 adds 1 changeset to branch 'master'
old head: 258d4ef93d3f51cef60b05d1c5ae418108b55782
new head: 11ff194b97c0772c72d9e4c5c08c8b1390d6e8e6
----------------------------------------------------------------------------
11ff194: Use strnlen instead of own impl, as it probably will have platform specific optimisation.
[ Fredrik Holmqvist <fredrik.holmqvist@gmail.com> ]
----------------------------------------------------------------------------
Revision: hrev44072
Commit: 11ff194b97c0772c72d9e4c5c08c8b1390d6e8e6
URL: http://cgit.haiku-os.org/haiku/commit/?id=11ff194
Author: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Date: Fri Apr 27 20:15:48 2012 UTC
----------------------------------------------------------------------------
1 file changed, 1 insertion(+), 5 deletions(-)
src/kits/support/String.cpp | 6 +-----
----------------------------------------------------------------------------
diff --git a/src/kits/support/String.cpp b/src/kits/support/String.cpp
index 990100f..d5b2c03 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);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic