On Sat, Jan 12, 2008 at 02:31:05PM +0100, Pavel Sanda wrote:
> > > +int countChars(DocIterator const & from, DocIterator const & to, bool 
> > > with_blanks)
> > > +{
> > > + int chars = 0;
> > > + int blanks = 0;
> > > + for (DocIterator dit = from ; dit != to ; dit.forwardPos()) {
> > > +         if (dit.inTexted()
> > > +             && dit.pos() != dit.lastpos()
> > > +             && !dit.paragraph().isDeleted(dit.pos())) {
> > > +                 if (dit.paragraph().isInset(dit.pos())) {
> > > +                         if 
> > > (dit.paragraph().getInset(dit.pos())->isLetter())
> > > +                                 ++chars;
> > > +                         else if 
> > > (dit.paragraph().getInset(dit.pos())->isSpace() && with_blanks)
> > > +                                 ++blanks;
> > 
> > Can't you use temporary variables for dit.paragraph() and
> > dit.paragraph().getInset(dit.pos())?
> 
> i changed it. btw you think this optimization in such kind of rarely used code
> is recognizable?

My main reason is that the code is less readable.

Andre'

Reply via email to