From bb2175681720cd6e4aac084f7912394e33245153 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Mon, 26 Nov 2007 23:59:51 +0000 Subject: [PATCH] less code and the DUUOB award for output_docbook.cpp git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21811 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/output_docbook.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/output_docbook.cpp b/src/output_docbook.cpp index f4cf212498..369bcb62d1 100644 --- a/src/output_docbook.cpp +++ b/src/output_docbook.cpp @@ -47,12 +47,10 @@ using std::string; namespace { ParagraphList::const_iterator searchParagraph( - ParagraphList::const_iterator const & par, + ParagraphList::const_iterator p, ParagraphList::const_iterator const & pend) { - ParagraphList::const_iterator p = boost::next(par); - - for (; p != pend && p->layout()->latextype == LATEX_PARAGRAPH; ++p) + for (++p; p != pend && p->layout()->latextype == LATEX_PARAGRAPH; ++p) ; return p; @@ -60,13 +58,12 @@ ParagraphList::const_iterator searchParagraph( ParagraphList::const_iterator searchCommand( - ParagraphList::const_iterator const & par, + ParagraphList::const_iterator p, ParagraphList::const_iterator const & pend) { - LayoutPtr const & bstyle = par->layout(); - ParagraphList::const_iterator p = boost::next(par); + LayoutPtr const & bstyle = p->layout(); - for ( ; p != pend; ++p) { + for (++p; p != pend; ++p) { LayoutPtr const & style = p->layout(); if (style->latextype == LATEX_COMMAND && style->commanddepth <= bstyle->commanddepth) @@ -77,27 +74,27 @@ ParagraphList::const_iterator searchCommand( ParagraphList::const_iterator searchEnvironment( - ParagraphList::const_iterator const & par, + ParagraphList::const_iterator p, ParagraphList::const_iterator const & pend) { - LayoutPtr const & bstyle = par->layout(); - ParagraphList::const_iterator p = boost::next(par); - for (; p != pend; ++p) { + LayoutPtr const & bstyle = p->layout(); + size_t const depth = p->params().depth(); + for (++p; p != pend; ++p) { LayoutPtr const & style = p->layout(); if (style->latextype == LATEX_COMMAND) return p; if (style->latextype == LATEX_PARAGRAPH) { - if (p->params().depth() > par->params().depth()) + if (p->params().depth() > depth) continue; return p; } - if (p->params().depth() < par->params().depth()) + if (p->params().depth() < depth) return p; if (style->latexname() != bstyle->latexname() - && p->params().depth() == par->params().depth() ) + && p->params().depth() == depth) return p; } return pend; -- 2.39.2