summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-11-05 21:50:55 +0100
committerEike Rathke <erack@redhat.com>2015-11-05 21:55:03 +0100
commit7aba9dcf13ac464acfcfe3cba7b2e5918790ce0e (patch)
treedd30e6a487715436e03ff01c15e0eb5f29f03a97
parentef6ddb36751f917cd4ddab4a7fc609d5cf212b1b (diff)
a vector is unnecessary here, tdf#79983 follow-up
Only the first case-insensitive match needs to be remembered. Change-Id: Ifac666760878f769bc04d567db9284eedaa40a65
-rw-r--r--sc/source/core/tool/userlist.cxx11
1 files changed, 4 insertions, 7 deletions
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index d29e38899451..3bc65eee96dd 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