From: Stefan Schimanski Date: Sun, 23 Dec 2007 01:28:03 +0000 (+0000) Subject: * cosmetic for loops with deep if nestings X-Git-Tag: 1.6.10~6829 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b2d70163b88a3ee8473c533192fd4a1104dc23fc;p=features.git * cosmetic for loops with deep if nestings git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22276 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/MathMacroTemplate.cpp b/src/mathed/MathMacroTemplate.cpp index 26018e1e75..e8ba817715 100644 --- a/src/mathed/MathMacroTemplate.cpp +++ b/src/mathed/MathMacroTemplate.cpp @@ -600,18 +600,19 @@ void fixMacroInstancesAddRemove(Cursor const & from, docstring const & name, int // in front of macro instance? Inset * inset = dit.nextInset(); - if (inset) { - InsetMath * insetMath = inset->asInsetMath(); - if (insetMath) { - MathMacro * macro = insetMath->asMacro(); - if (macro && macro->name() == name && macro->folded()) { - // found macro instance - if (insert) - macro->insertArgument(n); - else - macro->removeArgument(n); - } - } + if (!inset) + continue; + InsetMath * insetMath = inset->asInsetMath(); + if (!insetMath) + continue; + + MathMacro * macro = insetMath->asMacro(); + if (macro && macro->name() == name && macro->folded()) { + // found macro instance + if (insert) + macro->insertArgument(n); + else + macro->removeArgument(n); } } } @@ -631,15 +632,15 @@ void fixMacroInstancesOptional(Cursor const & from, docstring const & name, int // in front of macro instance? Inset * inset = dit.nextInset(); - if (inset) { - InsetMath * insetMath = inset->asInsetMath(); - if (insetMath) { - MathMacro * macro = insetMath->asMacro(); - if (macro && macro->name() == name && macro->folded()) { - // found macro instance - macro->setOptionals(optionals); - } - } + if (!inset) + continue; + InsetMath * insetMath = inset->asInsetMath(); + if (!insetMath) + continue; + MathMacro * macro = insetMath->asMacro(); + if (macro && macro->name() == name && macro->folded()) { + // found macro instance + macro->setOptionals(optionals); } } } @@ -661,14 +662,14 @@ void fixMacroInstancesFunctional(Cursor const & from, // in front of macro instance? Inset * inset = dit.nextInset(); - if (inset) { - InsetMath * insetMath = inset->asInsetMath(); - if (insetMath) { - MathMacro * macro = insetMath->asMacro(); - if (macro && macro->name() == name && macro->folded()) - F(macro); - } - } + if (!inset) + continue; + InsetMath * insetMath = inset->asInsetMath(); + if (!insetMath) + continue; + MathMacro * macro = insetMath->asMacro(); + if (macro && macro->name() == name && macro->folded()) + F(macro); } }