From b2d70163b88a3ee8473c533192fd4a1104dc23fc Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Sun, 23 Dec 2007 01:28:03 +0000 Subject: [PATCH] * cosmetic for loops with deep if nestings git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22276 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/MathMacroTemplate.cpp | 59 ++++++++++++++++---------------- 1 file changed, 30 insertions(+), 29 deletions(-) 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); } } -- 2.39.5