]> git.lyx.org Git - lyx.git/blobdiff - src/Thesaurus.cpp
Whitespace
[lyx.git] / src / Thesaurus.cpp
index cf8567eb53f5c9a5403296c3e1615ccd3ce7530d..1c1adc03b0e22cb91154ac21e396957b05997bb3 100644 (file)
 #include "support/FileNameList.h"
 #include "support/Package.h"
 #include "support/debug.h"
+#include "support/docstring.h"
 #include "support/docstring_list.h"
 #include "support/filetools.h"
-#include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/os.h"
 
 #include <cstdio>
 #include MYTHES_H_LOCATION
 
-#include "frontends/alert.h"
-
 #include <algorithm>
 #include <cstring>
 #include <fstream>
@@ -46,7 +44,7 @@ namespace {
 
 typedef std::map<docstring, MyThes *> Thesauri;
 
-} // namespace anon
+} // namespace
 
 struct Thesaurus::Private
 {
@@ -216,10 +214,10 @@ bool Thesaurus::thesaurusInstalled(docstring const & lang) const
 Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & wl)
 {
        Meanings meanings;
-       MyThes * mythes = 0;
+       MyThes * mythes = nullptr;
 
        docstring const lang_code = from_ascii(wl.lang()->code());
-       docstring const t = wl.word();
+       docstring const t = wl.word();
 
        if (!d->addThesaurus(lang_code))
                return meanings;
@@ -236,7 +234,7 @@ Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & wl)
                return meanings;
 
        string const encoding = mythes->get_th_encoding();
-       
+
        mentry * pmean;
        string const text = to_iconv_encoding(support::lowercase(t), encoding);
        int len = strlen(text.c_str());
@@ -268,6 +266,7 @@ Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & wl)
                // remove silly item
                if (support::prefixIs(meaning, '-'))
                        meaning = support::ltrim(meaning, "- ");
+               ret.reserve(pm->count);
                for (int j = 0; j < pm->count; j++) {
                        ret.push_back(from_iconv_encoding(string(pm->psyns[j]), encoding));
                }