From b8f8082aad49088238582658c22248f9469ad055 Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Fri, 29 Mar 2013 08:46:17 +0000
Subject: 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.

---
 generic/tkCmds.c | 21 +++++++--------------
 1 file 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;
 
-- 
cgit v0.12