From 6ef49d59c27e8380580e088027612435b431f346 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 29 May 2002 14:58:21 +0000 Subject: [PATCH] another 8% or so when loading the UserGuide... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4271 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/paragraph.C | 3 +-- src/paragraph_pimpl.C | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/paragraph.C b/src/paragraph.C index e52de16bcc..6a8c93fc2b 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -1141,8 +1141,7 @@ int Paragraph::beginningOfMainBody() const // and remember the previous character to // remove unnecessary GetChar() calls pos_type i = 0; - if (i < size() - && getChar(i) != Paragraph::META_NEWLINE) { + if (i < size() && getChar(i) != Paragraph::META_NEWLINE) { ++i; char previous_char = 0; char temp = 0; diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index 30de048e1d..f48ffbb866 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -89,13 +89,16 @@ void Paragraph::Pimpl::setContentsFromPar(Paragraph const * par) Paragraph::value_type Paragraph::Pimpl::getChar(pos_type pos) const { - lyx::Assert(pos <= size()); + // This is in the critical path for loading! + pos_type siz = size(); + lyx::Assert(pos <= siz); // This is stronger, and I belive that this is the assertion // that we should really use. (Lgb) //Assert(pos < size()); // Then this has no meaning. (Lgb) - if (!size() || pos == size()) return '\0'; + if (!siz || pos == siz) + return '\0'; return text[pos]; } -- 2.39.2