| 293 | } |
| 294 | |
| 295 | bool Value::CZString::operator<(const CZString& other) const { |
| 296 | if (!cstr_) |
| 297 | return index_ < other.index_; |
| 298 | // return strcmp(cstr_, other.cstr_) < 0; |
| 299 | // Assume both are strings. |
| 300 | unsigned this_len = this->storage_.length_; |
| 301 | unsigned other_len = other.storage_.length_; |
| 302 | unsigned min_len = std::min<unsigned>(this_len, other_len); |
| 303 | JSON_ASSERT(this->cstr_ && other.cstr_); |
| 304 | int comp = memcmp(this->cstr_, other.cstr_, min_len); |
| 305 | if (comp < 0) |
| 306 | return true; |
| 307 | if (comp > 0) |
| 308 | return false; |
| 309 | return (this_len < other_len); |
| 310 | } |
| 311 | |
| 312 | bool Value::CZString::operator==(const CZString& other) const { |
| 313 | if (!cstr_) |
nothing calls this directly
no test coverage detected