summaryrefslogtreecommitdiff
path: root/editors/xenon/files/patch-XeText.C
blob: 5025149131598ae846d6d35de6f353663411a4ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- XeText.C.orig	Sat Jan  5 20:39:39 2002
+++ XeText.C	Fri Dec  1 21:25:34 2006
@@ -1612,26 +1612,19 @@
 	
 	if(_numUndos >= _maxUndos) {
 		
-		// $$$ calling previous() here assums _undoList is not empty
-		// previous() is O(N) where N is the number of undo items in the list
-		// if this turns out to be too much of a performance penalty, use
-		// std::list instead of std::slist for _undoList
-		
-		std::slist<Undo*>::iterator pos = _undoList.previous(_undoList.end());
-		Undo* undo = *pos;
+		Undo* undo = _undoList.back();
 		
 		_undoBuf.remove(KRBUF_END, _undoBuf.length() - undo->len);
 		delete undo;
-		_undoList.erase(pos);
+		_undoList.pop_back();
 		
 		if (!_undoList.empty()) {
-			pos = _undoList.previous(_undoList.end());
-			undo = *pos;
+			undo = _undoList.back();
 			
 			if (undo && undo->type == InsertSelection) {
 				_undoBuf.remove(KRBUF_END, _undoBuf.length() - undo->len);
 				delete undo;
-				_undoList.erase(pos);
+				_undoList.pop_back();
 			}
 		}