[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Thu Nov 5 12:56:34 PST 2015
sc/source/core/tool/userlist.cxx | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
New commits:
commit 7aba9dcf13ac464acfcfe3cba7b2e5918790ce0e
Author: Eike Rathke <erack at redhat.com>
Date: Thu Nov 5 21:50:55 2015 +0100
a vector is unnecessary here, tdf#79983 follow-up
Only the first case-insensitive match needs to be remembered.
Change-Id: Ifac666760878f769bc04d567db9284eedaa40a65
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index d29e388..3bc65ee 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -274,7 +274,7 @@ ScUserList::ScUserList(const ScUserList& r) :
const ScUserListData* ScUserList::GetData(const OUString& rSubStr) const
{
- std::vector<DataType::const_iterator> matchData;
+ const ScUserListData* pFirstCaseInsensitive = nullptr;
DataType::const_iterator itr = maData.begin(), itrEnd = maData.end();
sal_uInt16 nIndex;
bool bMatchCase = false;
@@ -285,15 +285,12 @@ const ScUserListData* ScUserList::GetData(const OUString& rSubStr) const
{
if (bMatchCase)
return &(*itr);
- matchData.push_back(itr);
+ if (!pFirstCaseInsensitive)
+ pFirstCaseInsensitive = &(*itr);
}
}
- if (matchData.empty())
- {
- return NULL;
- }
- return &(**matchData.begin());
+ return pFirstCaseInsensitive;
}
const ScUserListData& ScUserList::operator[](size_t nIndex) const
More information about the Libreoffice-commits
mailing list