Kaydet (Commit) c37b27af authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Noel Grandin

sw: Avoid unnecessary copy in SwAutoCompleteWord::GetWordsMatching()

Its sole client code in sw/source/uibase/docvw/edtwin.cxx allows the
precondition that its 2nd argument rWords is empty.

This also corrects the @param description of the argument.

Change-Id: Icc12bc36d0d4157ed05ef10fb3c3db325c6bfaf2
Reviewed-on: https://gerrit.libreoffice.org/55943
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 5bbf40fd
......@@ -37,6 +37,7 @@
#include <sfx2/docfile.hxx>
#include <docsh.hxx>
#include <cassert>
#include <vector>
class SwAutoCompleteClient : public SwClient
......@@ -346,24 +347,13 @@ void SwAutoCompleteWord::SetMinWordLen( sal_uInt16 n )
/** Return all words matching a given prefix
*
* @param aMatch the prefix to search for
* @param aWords the words to search in
* @param rWords the words found matching
*/
bool SwAutoCompleteWord::GetWordsMatching(const OUString& aMatch, std::vector<OUString>& aWords) const
bool SwAutoCompleteWord::GetWordsMatching(const OUString& aMatch, std::vector<OUString>& rWords) const
{
std::vector<OUString> suggestions;
m_LookupTree.findSuggestions(aMatch, suggestions);
if (suggestions.empty())
{
return false;
}
for (const OUString & suggestion : suggestions)
{
aWords.push_back( suggestion );
}
return true;
assert(rWords.empty());
m_LookupTree.findSuggestions(aMatch, rWords);
return !rWords.empty();
}
void SwAutoCompleteWord::CheckChangedList(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment