ucstrcmp/eq: remove pointer equality check
People don't usually do s == s checks (or s != s for that matter), so having this here implies everyone else gets penalized. Change-Id: I83dda2d36c904517b3c0fffd17b38ecc324811ce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This commit is contained in:
parent
c41b6b7986
commit
06caefaacc
@ -1350,10 +1350,6 @@ static int ucstrncmp(const char16_t *a, const char *b, size_t l)
|
|||||||
template <typename Char2>
|
template <typename Char2>
|
||||||
static bool ucstreq(const char16_t *a, size_t alen, const Char2 *b)
|
static bool ucstreq(const char16_t *a, size_t alen, const Char2 *b)
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<decltype(a), decltype(b)>) {
|
|
||||||
if (a == b)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return ucstrncmp<CompareStringsForEquality>(a, b, alen) == 0;
|
return ucstrncmp<CompareStringsForEquality>(a, b, alen) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1361,10 +1357,6 @@ static bool ucstreq(const char16_t *a, size_t alen, const Char2 *b)
|
|||||||
template <typename Char2>
|
template <typename Char2>
|
||||||
static int ucstrcmp(const char16_t *a, size_t alen, const Char2 *b, size_t blen)
|
static int ucstrcmp(const char16_t *a, size_t alen, const Char2 *b, size_t blen)
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<decltype(a), decltype(b)>) {
|
|
||||||
if (a == b && alen == blen)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
const size_t l = qMin(alen, blen);
|
const size_t l = qMin(alen, blen);
|
||||||
int cmp = ucstrncmp<CompareStringsForOrdering>(a, b, l);
|
int cmp = ucstrncmp<CompareStringsForOrdering>(a, b, l);
|
||||||
return cmp ? cmp : qt_lencmp(alen, blen);
|
return cmp ? cmp : qt_lencmp(alen, blen);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user