bool StringData::equal(const StringData *s) const { assert(s); if (s == this) return true; int ret; if (!(m_hash < 0 || s->m_hash < 0)) { ret = numericCompare(s); if (ret >= -1) { return ret == 0; } } return same(s); }
int StringData::compare(const StringData *v2) const { ASSERT(v2); int ret = numericCompare(v2); if (ret < -1) { int len1 = size(); int len2 = v2->size(); int len = len1 < len2 ? len1 : len2; ret = memcmp(data(), v2->data(), len); if (ret) return ret; if (len1 == len2) return 0; return len < len1 ? 1 : -1; } return ret; }
HOT_FUNC int StringData::compare(const StringData *v2) const { assert(v2); if (v2 == this) return 0; int ret = numericCompare(v2); if (ret < -1) { int len1 = size(); int len2 = v2->size(); int len = len1 < len2 ? len1 : len2; ret = memcmp(rawdata(), v2->rawdata(), len); if (ret) return ret; if (len1 == len2) return 0; return len < len1 ? 1 : -1; } return ret; }
HOT_FUNC int StringData::compare(const StringData *v2) const { ASSERT(v2); if (v2 == this) return 0; int ret = numericCompare(v2); if (ret < -1) { int len1 = size(); int len2 = v2->size(); int len = len1 < len2 ? len1 : len2; // No taint absorption on self-contained string ops like compare ret = memcmp(rawdata(), v2->rawdata(), len); if (ret) return ret; if (len1 == len2) return 0; return len < len1 ? 1 : -1; } return ret; }