From 6525159a41b0944980323172bdc0565ff642932c Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 16 Dec 2008 16:01:32 +0000 Subject: [PATCH] Exit early to avoid indentation. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27897 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/TextClass.cpp | 60 +++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 8e308aee99..d401af9cf7 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -372,40 +372,40 @@ TextClass::ReturnValues TextClass::read(Lexer & lexrc, ReadType rt) } break; - case TC_STYLE: - if (lexrc.next()) { - docstring const name = from_utf8(subst(lexrc.getString(), - '_', ' ')); - if (name.empty()) { - string s = "Could not read name for style: `$$Token' " - + lexrc.getString() + " is probably not valid UTF-8!"; - lexrc.printError(s.c_str()); - Layout lay; - // Since we couldn't read the name, we just scan the rest - // of the style and discard it. - error = !readStyle(lexrc, lay); - } else if (hasLayout(name)) { - Layout & lay = operator[](name); - error = !readStyle(lexrc, lay); - } else { - Layout layout; - layout.setName(name); - error = !readStyle(lexrc, layout); - if (!error) - layoutlist_.push_back(layout); - - if (defaultlayout_.empty()) { - // We do not have a default layout yet, so we choose - // the first layout we encounter. - defaultlayout_ = name; - } - } - } - else { + case TC_STYLE: { + if (!lexrc.next()) { lexrc.printError("No name given for style: `$$Token'."); error = true; + break; + } + docstring const name = from_utf8(subst(lexrc.getString(), + '_', ' ')); + if (name.empty()) { + string s = "Could not read name for style: `$$Token' " + + lexrc.getString() + " is probably not valid UTF-8!"; + lexrc.printError(s.c_str()); + Layout lay; + // Since we couldn't read the name, we just scan the rest + // of the style and discard it. + error = !readStyle(lexrc, lay); + } else if (hasLayout(name)) { + Layout & lay = operator[](name); + error = !readStyle(lexrc, lay); + } else { + Layout layout; + layout.setName(name); + error = !readStyle(lexrc, layout); + if (!error) + layoutlist_.push_back(layout); + + if (defaultlayout_.empty()) { + // We do not have a default layout yet, so we choose + // the first layout we encounter. + defaultlayout_ = name; + } } break; + } case TC_NOSTYLE: if (lexrc.next()) { -- 2.39.2