diff options
Diffstat (limited to 'generic/tkUndo.c')
-rw-r--r-- | generic/tkUndo.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/generic/tkUndo.c b/generic/tkUndo.c index bf2ed7c..a642e72 100644 --- a/generic/tkUndo.c +++ b/generic/tkUndo.c @@ -94,7 +94,7 @@ TkUndoInsertSeparator( TkUndoAtom *separator; if (*stack!=NULL && (*stack)->type!=TK_UNDO_SEPARATOR) { - separator = (TkUndoAtom *) ckalloc(sizeof(TkUndoAtom)); + separator = ckalloc(sizeof(TkUndoAtom)); separator->type = TK_UNDO_SEPARATOR; TkUndoPushStack(stack,separator); return 1; @@ -135,7 +135,7 @@ TkUndoClearStack( if (sub->action != NULL) { Tcl_DecrRefCount(sub->action); } - ckfree((char *)sub); + ckfree(sub); sub = next; } @@ -146,11 +146,11 @@ TkUndoClearStack( if (sub->action != NULL) { Tcl_DecrRefCount(sub->action); } - ckfree((char *)sub); + ckfree(sub); sub = next; } } - ckfree((char *)elem); + ckfree(elem); } *stack = NULL; } @@ -181,7 +181,7 @@ TkUndoPushAction( { TkUndoAtom *atom; - atom = (TkUndoAtom *) ckalloc(sizeof(TkUndoAtom)); + atom = ckalloc(sizeof(TkUndoAtom)); atom->type = TK_UNDO_ACTION; atom->apply = apply; atom->revert = revert; @@ -237,7 +237,7 @@ TkUndoMakeCmdSubAtom( Tcl_Panic("NULL command and actionScript in TkUndoMakeCmdSubAtom"); } - atom = (TkUndoSubAtom *) ckalloc(sizeof(TkUndoSubAtom)); + atom = ckalloc(sizeof(TkUndoSubAtom)); atom->command = command; atom->funcPtr = NULL; atom->clientData = NULL; @@ -299,7 +299,7 @@ TkUndoMakeSubAtom( Tcl_Panic("NULL funcPtr in TkUndoMakeSubAtom"); } - atom = (TkUndoSubAtom *) ckalloc(sizeof(TkUndoSubAtom)); + atom = ckalloc(sizeof(TkUndoSubAtom)); atom->command = NULL; atom->funcPtr = funcPtr; atom->clientData = clientData; @@ -341,7 +341,7 @@ TkUndoInitStack( { TkUndoRedoStack *stack; /* An Undo/Redo stack */ - stack = (TkUndoRedoStack *) ckalloc(sizeof(TkUndoRedoStack)); + stack = ckalloc(sizeof(TkUndoRedoStack)); stack->undoStack = NULL; stack->redoStack = NULL; stack->interp = interp; @@ -392,6 +392,7 @@ TkUndoSetDepth( prevelem = elem; elem = elem->next; } + CLANG_ASSERT(prevelem); prevelem->next = NULL; while (elem != NULL) { prevelem = elem; @@ -403,7 +404,7 @@ TkUndoSetDepth( if (sub->action != NULL) { Tcl_DecrRefCount(sub->action); } - ckfree((char *)sub); + ckfree(sub); sub = next; } sub = elem->revert; @@ -413,12 +414,12 @@ TkUndoSetDepth( if (sub->action != NULL) { Tcl_DecrRefCount(sub->action); } - ckfree((char *)sub); + ckfree(sub); sub = next; } } elem = elem->next; - ckfree((char *) prevelem); + ckfree(prevelem); } stack->depth = stack->maxdepth; } @@ -471,7 +472,7 @@ TkUndoFreeStack( TkUndoRedoStack *stack) /* An Undo/Redo stack */ { TkUndoClearStacks(stack); - ckfree((char *) stack); + ckfree(stack); } /* @@ -540,7 +541,7 @@ TkUndoRevert( } if (elem->type == TK_UNDO_SEPARATOR) { - ckfree((char *) elem); + ckfree(elem); elem = TkUndoPopStack(&stack->undoStack); } @@ -602,7 +603,7 @@ TkUndoApply( } if (elem->type == TK_UNDO_SEPARATOR) { - ckfree((char *) elem); + ckfree(elem); elem = TkUndoPopStack(&stack->redoStack); } @@ -654,7 +655,7 @@ EvaluateActionList( while (action != NULL) { if (action->funcPtr != NULL) { - result = (*action->funcPtr)(interp, action->clientData, + result = action->funcPtr(interp, action->clientData, action->action); } else if (action->command != NULL) { Tcl_Obj *cmdNameObj, *evalObj; |