From 85dc06662e77a7e1a61300888ecf2af5ff29e4c3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 22 Aug 2012 11:44:20 +0200 Subject: simplify ProString::operator==() implementations we can trivially construct a QStringRef from a ProString, so take advantage of that. Change-Id: I9aaa1f6d910590872b250a145f16e90984beeb94 Reviewed-by: Daniel Teske --- src/shared/proparser/proitems.cpp | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'src/shared/proparser/proitems.cpp') diff --git a/src/shared/proparser/proitems.cpp b/src/shared/proparser/proitems.cpp index 962268ca7d..1b16ded4d5 100644 --- a/src/shared/proparser/proitems.cpp +++ b/src/shared/proparser/proitems.cpp @@ -155,39 +155,6 @@ QString &ProString::toQString(QString &tmp) const return tmp.setRawData(m_string.constData() + m_offset, m_length); } -bool ProString::operator==(const ProString &other) const -{ - if (m_length != other.m_length) - return false; - return !memcmp(m_string.constData() + m_offset, - other.m_string.constData() + other.m_offset, m_length * 2); -} - -bool ProString::operator==(const QString &other) const -{ - if (m_length != other.length()) - return false; - return !memcmp(m_string.constData() + m_offset, other.constData(), m_length * 2); -} - -bool ProString::operator==(const QLatin1String &other) const -{ - const ushort *uc = (ushort *)m_string.constData() + m_offset; - const ushort *e = uc + m_length; - const uchar *c = (uchar *)other.latin1(); - - if (!c) - return isEmpty(); - - while (*c) { - if (uc == e || *uc != *c) - return false; - ++uc; - ++c; - } - return (uc == e); -} - QChar *ProString::prepareAppend(int extraLen) { if (m_string.isDetached() && m_length + extraLen <= m_string.capacity()) { -- cgit v1.2.1