]> git.lyx.org Git - features.git/commitdiff
less code and the DUUOB award for output_docbook.cpp
authorAndré Pönitz <poenitz@gmx.net>
Mon, 26 Nov 2007 23:59:51 +0000 (23:59 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 26 Nov 2007 23:59:51 +0000 (23:59 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21811 a592a061-630c-0410-9148-cb99ea01b6c8

src/output_docbook.cpp

index f4cf212498cf0cdfd79032010100be3f2128fa0f..369bcb62d128021061c7eb76cb4af8cbddb4f516 100644 (file)
@@ -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;