]> git.lyx.org Git - features.git/commitdiff
Some performance stuff reported by cppcheck
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 24 Feb 2015 09:17:45 +0000 (10:17 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 24 Feb 2015 17:38:20 +0000 (18:38 +0100)
12 files changed:
src/Buffer.cpp
src/LyX.cpp
src/Paragraph.cpp
src/Text.cpp
src/Text2.cpp
src/Text3.cpp
src/TextMetrics.cpp
src/insets/InsetCaption.cpp
src/insets/InsetCitation.cpp
src/insets/InsetListings.cpp
src/insets/InsetRef.cpp
src/insets/InsetWrap.cpp

index b8e233a78120e140f64fc688bcf3c403bc9649e4..f6af77d364c01ff2edd390e192905fd5bf9d7f53 100644 (file)
@@ -1851,7 +1851,7 @@ void Buffer::writeDocBookSource(odocstream & os, string const & fname,
        d->texrow.reset();
 
        DocumentClass const & tclass = params().documentClass();
-       string const top_element = tclass.latexname();
+       string const top_element = tclass.latexname();
 
        bool const output_preamble =
                output == FullSource || output == OnlyPreamble;
index 8b75b44c087d5e41a8a1cf2708836dcf81b9e326..f06b9709250ffce9181a1f69f923bea60b49ff29 100644 (file)
@@ -763,7 +763,7 @@ void cleanDuplicateEnvVars()
        }
 
        // Loop over the list of duplicated variables
-       for (std::set<std::string>::iterator dupe = dupes.begin(); dupe != dupes.end(); dupe++) {
+       for (std::set<std::string>::iterator dupe = dupes.begin(); dupe != dupes.end(); ++dupe) {
                const char *name = (*dupe).c_str();
                char *val = getenv(name);
                if (val != NULL) {
index 8ee06ea01fc449787805e6e707003fb2a6a22a20..0570753fa9788a042bff406a175af3ebd48800d7 100644 (file)
@@ -620,7 +620,7 @@ bool Paragraph::isMergedOnEndOfParDeletion(bool trackChanges) const
        if (!trackChanges)
                return true;
 
-       Change const change = d->changes_.lookup(size());
+       Change const change = d->changes_.lookup(size());
        return change.inserted() && change.currentAuthor();
 }
 
@@ -1640,7 +1640,7 @@ void Paragraph::write(ostream & os, BufferParams const & bparams,
        int column = 0;
        for (pos_type i = 0; i <= size(); ++i) {
 
-               Change const change = lookupChange(i);
+               Change const change = lookupChange(i);
                if (change != running_change)
                        flushString(os, write_buffer);
                Changes::lyxMarkChange(os, bparams, column, running_change, change);
index a2ae1aed8f33b772ea527dbb824c2ff9b874bc4f..a448a5c7eebadc98947b2ffe2bc974adf43546e7 100644 (file)
@@ -113,8 +113,8 @@ static bool moveItem(Paragraph & fromPar, pos_type fromPos,
        // Therefore, it should only be used for breaking and merging paragraphs
 
        // We need a copy here because the character at fromPos is going to be erased.
-       Font const tmpFont = fromPar.getFontSettings(params, fromPos);
-       Change const tmpChange = fromPar.lookupChange(fromPos);
+       Font const tmpFont = fromPar.getFontSettings(params, fromPos);
+       Change const tmpChange = fromPar.lookupChange(fromPos);
 
        if (Inset * tmpInset = fromPar.getInset(fromPos)) {
                fromPar.releaseInset(fromPos);
@@ -2057,11 +2057,11 @@ void Text::charsTranspose(Cursor & cur)
 
        // Store the characters to be transposed (including font information).
        char_type const char1 = par.getChar(pos1);
-       Font const font1 =
+       Font const font1 =
                par.getFontSettings(cur.buffer()->params(), pos1);
 
        char_type const char2 = par.getChar(pos2);
-       Font const font2 =
+       Font const font2 =
                par.getFontSettings(cur.buffer()->params(), pos2);
 
        // And finally, we are ready to perform the transposition.
index 4f6a975957e1e54a809a3269bfae49b76b008419..2597e35edffb4ec50b7834d42e1b9dbce74ef23f 100644 (file)
@@ -408,7 +408,7 @@ void Text::toggleFree(Cursor & cur, Font const & font, bool toggleall)
        // Try implicit word selection
        // If there is a change in the language the implicit word selection
        // is disabled.
-       CursorSlice const resetCursor = cur.top();
+       CursorSlice const resetCursor = cur.top();
        bool const implicitSelection =
                font.language() == ignore_language
                && font.fontInfo().number() == FONT_IGNORE
index e2602f031baeea50143aaec14f0e1fc9df5a63da..f49274fb4df11495ed550efd50e5ff775bc009dd 100644 (file)
@@ -476,7 +476,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
        cur.noScreenUpdate();
 
        LBUFERR(this == cur.text());
-       CursorSlice const oldTopSlice = cur.top();
+       CursorSlice const oldTopSlice = cur.top();
        bool const oldBoundary = cur.boundary();
        bool const oldSelection = cur.selection();
        // Signals that, even if needsUpdate == false, an update of the
index 2119f8ed16037416359c9792d3187e8878516310..afc7f4ebdc99e774f1171aee7654f37cd49def82 100644 (file)
@@ -446,7 +446,7 @@ bool TextMetrics::redoParagraph(pit_type const pit)
                MacroContext mc(&buffer, parPos);
                MetricsInfo mi(bv_, font.fontInfo(), w, mc);
                ii->inset->metrics(mi, dim);
-               Dimension const old_dim = pm.insetDimension(ii->inset);
+               Dimension const old_dim = pm.insetDimension(ii->inset);
                if (old_dim != dim) {
                        pm.setInsetDimension(ii->inset, dim);
                        changed = true;
index 8af9827b3ade32b94490b1641fbe4c67dbc6ab25..ad6ec01d1a278246a439a2a4780e79c9bd28638b 100644 (file)
@@ -299,7 +299,7 @@ docstring InsetCaption::xhtml(XHTMLStream & xs, OutputParams const & rp) const
        if (rp.html_disable_captions)
                return docstring();
        InsetLayout const & il = getLayout();
-       string const tag = il.htmltag();
+       string const tag = il.htmltag();
        string attr = il.htmlattr();
        if (!type_.empty()) {
                string const our_class = "float-caption-" + type_;
index 8f697993b143c94d43d011c2a6fbd50bdf5bfa80..36dc3763085147efc994ad84349835bd29d360ba 100644 (file)
@@ -183,7 +183,7 @@ docstring InsetCitation::toolTip(BufferView const & bv, int, int) const
 namespace {
 
 
-CitationStyle asValidLatexCommand(string const & input, vector<CitationStyle> const valid_styles)
+CitationStyle asValidLatexCommand(string const & input, vector<CitationStyle> const valid_styles)
 {
        CitationStyle cs = valid_styles[0];
        cs.forceUpperCase = false;
index e9a89cf5203ff00df5e007339638abc81351abff..f6b699b4a8051de74fc05d1047dc6b0f37be3056 100644 (file)
@@ -284,7 +284,7 @@ docstring InsetListings::xhtml(XHTMLStream & os, OutputParams const & rp) const
        }
 
        InsetLayout const & il = getLayout();
-       string const tag = il.htmltag();
+       string const tag = il.htmltag();
        string attr = "class ='listings";
        string const lang = params().getParamValue("language");
        if (!lang.empty())
index 5ac6b469665bbc0bfd4bf734d8178ebe7e136ee9..bd6b2ecfec204952e81dd455d152a3bd4bad227a 100644 (file)
@@ -140,8 +140,8 @@ docstring InsetRef::getEscapedLabel(OutputParams const & rp) const
 
 void InsetRef::latex(otexstream & os, OutputParams const & rp) const
 {
-       string const cmd = getCmdName();
-       docstring const data = getEscapedLabel(rp);
+       string const cmd = getCmdName();
+       docstring const data = getEscapedLabel(rp);
 
        if (rp.inulemcmd > 0)
                os << "\\mbox{";
index 181474a889feb3f7ed5e49795f9005805f7123bb..d86fc25c3d43a2f35de0b288a34dbc02b6555d78 100644 (file)
@@ -230,7 +230,7 @@ docstring InsetWrap::xhtml(XHTMLStream & xs, OutputParams const & rp) const
        string const len = params_.width.asHTMLString();
        string const width = len.empty() ? "50%" : len;
        InsetLayout const & il = getLayout();
-       string const tag = il.htmltag();
+       string const tag = il.htmltag();
        string const attr = il.htmlattr() + " style='width:" + width + ";'";
        xs << html::StartTag(tag, attr);
        docstring const deferred =