]> git.lyx.org Git - features.git/commitdiff
Avoid assignment in if() clause
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 14 Dec 2017 10:22:05 +0000 (11:22 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 14 Dec 2017 11:56:02 +0000 (12:56 +0100)
The optimization they provide is not worth it IMO.

Fixes bugs #10898, #10899, #10940.

src/insets/InsetBibtex.cpp
src/insets/InsetCaption.cpp
src/tex2lyx/Preamble.cpp

index 4ecb5227378b13391166ddf8b616a0c71e8ee73a..0db4555ce0f0d31bd5bb394d6bf2fbe4f03a041b 100644 (file)
@@ -459,11 +459,9 @@ namespace {
                        return false;
 
                // read value
-               bool legalChar = true;
                while (ifs && !isSpace(ch) &&
-                                                delimChars.find(ch) == docstring::npos &&
-                                                (legalChar = (illegalChars.find(ch) == docstring::npos))
-                                       )
+                      delimChars.find(ch) == docstring::npos &&
+                      illegalChars.find(ch) == docstring::npos)
                {
                        if (chCase == makeLowerCase)
                                val += lowercase(ch);
@@ -472,7 +470,7 @@ namespace {
                        ifs.get(ch);
                }
 
-               if (!legalChar) {
+               if (illegalChars.find(ch) != docstring::npos) {
                        ifs.putback(ch);
                        return false;
                }
index 5f7978ab3288f2206f6e509c9cf5f6585e81b123..8778d78730484c4554e9c67ba7f42cfdcccd9b02 100644 (file)
@@ -388,7 +388,8 @@ void InsetCaption::updateBuffer(ParIterator const & it, UpdateType utype)
                else
                        name = master.B_(tclass.floats().getType(type).name());
                docstring counter = from_utf8(type);
-               if ((is_subfloat_ = cnts.isSubfloat())) {
+               is_subfloat_ = cnts.isSubfloat();
+               if (is_subfloat_) {
                        // only standard captions allowed in subfloats
                        type_ = "Standard";
                        counter = "sub-" + from_utf8(type);
index ea315dd156677da80c165acdce4cbe8e97c5fed9..2b5d7062abb607d87fc0fb22f60d94d05fdc6fbd 100644 (file)
@@ -689,7 +689,6 @@ void Preamble::handle_package(Parser &p, string const & name,
 {
        vector<string> options = split_options(opts);
        add_package(name, options);
-       char const * const * where = 0;
 
        if (is_known(name, known_xetex_packages)) {
                xetex = true;
@@ -1016,7 +1015,7 @@ void Preamble::handle_package(Parser &p, string const & name,
        else if (name == "subfig")
                ; // ignore this FIXME: Use the package separator mechanism instead
 
-       else if ((where = is_known(name, known_languages)))
+       else if (char const * const * where = is_known(name, known_languages))
                h_language = known_coded_languages[where - known_languages];
 
        else if (name == "natbib") {