From 3a2a63d32232e51c4561b828453e558c84479cbe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 29 Apr 2003 15:24:37 +0000 Subject: [PATCH] restrict scope of temporary variables git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6886 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/undo_funcs.C | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/undo_funcs.C b/src/undo_funcs.C index 55ac747a3a..7055d6de65 100644 --- a/src/undo_funcs.C +++ b/src/undo_funcs.C @@ -77,10 +77,8 @@ bool textHandleUndo(BufferView * bv, Undo & undo) { Buffer * b = bv->buffer(); - Paragraph * before = &*b->getParFromID(undo.number_of_before_par); - Paragraph * behind = &*b->getParFromID(undo.number_of_behind_par); - Paragraph * tmppar; - Paragraph * tmppar2; + Paragraph * const before = &*b->getParFromID(undo.number_of_before_par); + Paragraph * const behind = &*b->getParFromID(undo.number_of_behind_par); // if there's no before take the beginning // of the document for redoing @@ -102,7 +100,7 @@ bool textHandleUndo(BufferView * bv, Undo & undo) Paragraph * undopar = undo.par; undo.par = 0; /* otherwise the undo destructor would - delete the paragraph */ + delete the paragraph */ // get last undo par and set the right(new) inset-owner of the // paragraph if there is any. This is not needed if we don't have @@ -124,18 +122,17 @@ bool textHandleUndo(BufferView * bv, Undo & undo) vector deletelist; - Paragraph * deletepar; - // now add old paragraphs to be deleted if (before != behind || (!behind && !before)) { + Paragraph * deletepar; if (before) deletepar = before->next(); else deletepar = firstUndoParagraph(bv, undo.number_of_inset_id); - tmppar2 = undopar; + Paragraph * tmppar2 = undopar; while (deletepar && deletepar != behind) { deletelist.push_back(deletepar); - tmppar = deletepar; + Paragraph * tmppar = deletepar; deletepar = deletepar->next(); // a memory optimization for edit: @@ -217,14 +214,15 @@ bool textHandleUndo(BufferView * bv, Undo & undo) if (behind) endpar = behind->next(); - tmppar = &*bv->buffer()->getParFromID(undo.number_of_cursor_par); - UpdatableInset* it = 0; + UpdatableInset * it = 0; if (undopar) it = static_cast(undopar->inInset()); if (it) { it->getLyXText(bv)->redoParagraphs( it->getLyXText(bv)->cursor, endpar); + Paragraph * tmppar = + &*bv->buffer()->getParFromID(undo.number_of_cursor_par); if (tmppar) { it = static_cast(tmppar->inInset()); LyXText * t; @@ -247,6 +245,8 @@ bool textHandleUndo(BufferView * bv, Undo & undo) bv->text->cursor.pos()); } else { bv->text->redoParagraphs(bv->text->cursor, endpar); + Paragraph * tmppar = + &*bv->buffer()->getParFromID(undo.number_of_cursor_par); if (tmppar) { LyXText * t; Inset * it = tmppar->inInset(); -- 2.39.2