summaryrefslogtreecommitdiffstats
path: root/generic/tkUndo.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-05-17 20:00:20 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-05-17 20:00:20 (GMT)
commitf3307676078f98736473d67cf210cbf543497648 (patch)
treedab7dc3f799b4a2692b2be6c74da6f4eed2dc2f3 /generic/tkUndo.c
parent2ed8ef5276ad3e9622e083aea0edbb5d15c83500 (diff)
downloadtk-f3307676078f98736473d67cf210cbf543497648.zip
tk-f3307676078f98736473d67cf210cbf543497648.tar.gz
tk-f3307676078f98736473d67cf210cbf543497648.tar.bz2
Took comments from Koen Danckaert into account (with my thanks) to simplify the implementation of TkUndoCanUndo() and TkUndoCanRedo() in tkUndo.c, and in tkText.c to remove direct calls to internals of the undo or redo stack
Diffstat (limited to 'generic/tkUndo.c')
-rw-r--r--generic/tkUndo.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/generic/tkUndo.c b/generic/tkUndo.c
index 5934154..c66905d 100644
--- a/generic/tkUndo.c
+++ b/generic/tkUndo.c
@@ -495,17 +495,7 @@ int
TkUndoCanRedo(
TkUndoRedoStack *stack) /* An Undo/Redo stack */
{
- int canRedo = 0;
- TkUndoAtom *elem = stack->redoStack;
-
- while (elem != NULL) {
- if (elem->type != TK_UNDO_SEPARATOR) {
- canRedo = 1;
- break;
- }
- elem = elem->next;
- }
- return canRedo;
+ return stack->redoStack != NULL;
}
/*
@@ -528,17 +518,7 @@ int
TkUndoCanUndo(
TkUndoRedoStack *stack) /* An Undo/Redo stack */
{
- int canUndo = 0;
- TkUndoAtom *elem = stack->undoStack;
-
- while (elem != NULL) {
- if (elem->type != TK_UNDO_SEPARATOR) {
- canUndo = 1;
- break;
- }
- elem = elem->next;
- }
- return canUndo;
+ return stack->undoStack != NULL;
}
/*