]> git.lyx.org Git - lyx.git/commitdiff
Avoid a couple copies in Trans::addDeadKeys().
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 12 Sep 2024 15:24:32 +0000 (17:24 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 12 Sep 2024 15:24:32 +0000 (17:24 +0200)
Spotted by Coverity scan.

src/Trans.cpp
src/Trans.h

index 774c7ac7ced71df05a5ba0a7cef0f7c57b362bdf..2a3daf9df00bdb7022569a3fc6c00277107c4ba8 100644 (file)
@@ -176,19 +176,13 @@ tex_accent getkeymod(string const &);
 
 void Trans::addDeadkey(tex_accent accent, docstring const & keys)
 {
-       KmodInfo tmp;
-       tmp.data = keys;
-       tmp.accent = accent;
-       kmod_list_[accent] = tmp;
+       kmod_list_[accent] = KmodInfo(keys, accent, KmodException());
 
        for (char_type key : keys) {
                // FIXME This is a hack.
                // tmp is no valid UCS4 string, but misused to store the
                // accent.
-               docstring tmpd;
-               tmpd += char_type(0);
-               tmpd += char_type(accent);
-               keymap_[key] = tmpd;
+               keymap_[key] = docstring() + char_type(0) + char_type(accent);
        }
 }
 
index aefb4adff070d0b9b8d604d551dd0f89d0a1604f..c8d828e78536991a8ce24b4647097a96387f5b50 100644 (file)
@@ -112,6 +112,9 @@ public:
        ///
        KmodInfo() : accent(TEX_NOACCENT) {}
        ///
+       KmodInfo(docstring const & d, tex_accent a, KmodException const & e)
+               : data(d), accent(a), exception_list(e) {}
+       ///
        docstring data;
        ///
        tex_accent accent;