Commit b92d0ebd authored by Kosta's avatar Kosta

code cleanup for `StringEqual()`

Instead of replicating the functionality of `GetString()` and `GetStringLength()` in `StringEqual()` it now calls these methods instead.
parent 3caa86c9
...@@ -1498,12 +1498,12 @@ private: ...@@ -1498,12 +1498,12 @@ private:
RAPIDJSON_ASSERT(IsString()); RAPIDJSON_ASSERT(IsString());
RAPIDJSON_ASSERT(rhs.IsString()); RAPIDJSON_ASSERT(rhs.IsString());
const SizeType len1 = (flags_ == kShortStringFlag) ? data_.ss.length : data_.s.length; const SizeType len1 = GetStringLength();
const SizeType len2 = (rhs.flags_ == kShortStringFlag) ? rhs.data_.ss.length : rhs.data_.s.length; const SizeType len2 = rhs.GetStringLength();
if(len1 != len2) { return false; } if(len1 != len2) { return false; }
const Ch* const str1 = (flags_ == kShortStringFlag) ? data_.ss.str : data_.s.str; const Ch* const str1 = GetString();
const Ch* const str2 = (rhs.flags_ == kShortStringFlag) ? rhs.data_.ss.str : rhs.data_.s.str; const Ch* const str2 = rhs.GetString();
if(str1 == str2) { return true; } // fast path for constant string if(str1 == str2) { return true; } // fast path for constant string
return (memcmp(str1, str2, sizeof(Ch) * len1) == 0); return (memcmp(str1, str2, sizeof(Ch) * len1) == 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment