From: JINMEI Tatuya Date: Wed, 9 Jan 2013 04:18:06 +0000 (-0800) Subject: [2571] a small optimization: avoid calling strlen() every time in loop X-Git-Tag: bind10-1.0.0-rc-release~76^2~21^2~2^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1c59e1ee00a8d1ebabfabb592ee910b22c72f1d9;p=thirdparty%2Fkea.git [2571] a small optimization: avoid calling strlen() every time in loop --- diff --git a/src/lib/cc/data.cc b/src/lib/cc/data.cc index e868165f37..f9c23db45b 100644 --- a/src/lib/cc/data.cc +++ b/src/lib/cc/data.cc @@ -16,6 +16,7 @@ #include +#include #include #include #include @@ -241,7 +242,8 @@ Element::createMap() { namespace { bool charIn(const int c, const char* chars) { - for (size_t i = 0; i < strlen(chars); ++i) { + const size_t chars_len = std::strlen(chars); + for (size_t i = 0; i < chars_len; ++i) { if (chars[i] == c) { return (true); }