diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-03-29 08:46:17 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-03-29 08:46:17 (GMT) |
commit | b8f8082aad49088238582658c22248f9469ad055 (patch) | |
tree | fae3aeb7f19b0b704716984cfe156e3fb17dfaf1 | |
parent | 0198f40eb58a938f901dac686a48e9635c8d1156 (diff) | |
download | tk-b8f8082aad49088238582658c22248f9469ad055.zip tk-b8f8082aad49088238582658c22248f9469ad055.tar.gz tk-b8f8082aad49088238582658c22248f9469ad055.tar.bz2 |
One last review of tkCmds.c, making sure that there is no single mistake in it.
Found one unnecessary IncrRefCount/DecrRefcount, some unneeded type cast and a few more cleanups, all already fixed in Tk 8.6. So better backport that too.
-rw-r--r-- | generic/tkCmds.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/generic/tkCmds.c b/generic/tkCmds.c index a655341..acb7496 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -236,7 +236,7 @@ TkBindEventProc( ClientData objects[MAX_OBJS], *objPtr; TkWindow *topLevPtr; int i, count; - char *p; + const char *p; Tcl_HashEntry *hPtr; if ((winPtr->mainPtr == NULL) || (winPtr->mainPtr->bindingTable == NULL)) { @@ -255,7 +255,7 @@ TkBindEventProc( (winPtr->numTags * sizeof(ClientData))); } for (i = 0; i < winPtr->numTags; i++) { - p = (char *) winPtr->tagPtr[i]; + p = winPtr->tagPtr[i]; if (*p == '.') { hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->nameTable, p); if (hPtr != NULL) { @@ -331,7 +331,6 @@ Tk_BindtagsObjCmd( } if (objc == 2) { listPtr = Tcl_NewObj(); - Tcl_IncrRefCount(listPtr); if (winPtr->numTags == 0) { Tcl_ListObjAppendElement(interp, listPtr, Tcl_NewStringObj(winPtr->pathName, -1)); @@ -354,7 +353,6 @@ Tk_BindtagsObjCmd( } } Tcl_SetObjResult(interp, listPtr); - Tcl_DecrRefCount(listPtr); return TCL_OK; } if (winPtr->tagPtr != NULL) { @@ -415,10 +413,10 @@ TkFreeBindingTags( TkWindow *winPtr) /* Window whose tags are to be released. */ { int i; - char *p; + const char *p; for (i = 0; i < winPtr->numTags; i++) { - p = (char *) (winPtr->tagPtr[i]); + p = winPtr->tagPtr[i]; if (*p == '.') { /* * Names starting with "." are malloced rather than Uids, so they @@ -1059,8 +1057,7 @@ WaitVisibilityProc( if (eventPtr->type == VisibilityNotify) { *donePtr = 1; - } - if (eventPtr->type == DestroyNotify) { + } else if (eventPtr->type == DestroyNotify) { *donePtr = 2; } } @@ -1555,9 +1552,7 @@ Tk_WinfoObjCmd( Tcl_SetStringObj(resultPtr, Tk_PathName(tkwin), -1); } break; - case WIN_INTERPS: { - int result; - + case WIN_INTERPS: skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { return TCL_ERROR; @@ -1566,9 +1561,7 @@ Tk_WinfoObjCmd( Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window?"); return TCL_ERROR; } - result = TkGetInterpNames(interp, tkwin); - return result; - } + return TkGetInterpNames(interp, tkwin); case WIN_PATHNAME: { Window id; |