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)
commitd1ed9566df0379d64ce1bcbeb9cf4d6ce5054dc1 (patch)
treedab7dc3f799b4a2692b2be6c74da6f4eed2dc2f3 /generic/tkUndo.c
parent8d4c26fbadf5ae5ecc09a1290cb03fbe6be2cc09 (diff)
downloadtk-d1ed9566df0379d64ce1bcbeb9cf4d6ce5054dc1.zip
tk-d1ed9566df0379d64ce1bcbeb9cf4d6ce5054dc1.tar.gz
tk-d1ed9566df0379d64ce1bcbeb9cf4d6ce5054dc1.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 stacktip_446
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;
}
/*