Subject: more Tcl_NewIntObj/Tcl_NewBooleanObj -> Tcl_NewLongObj conversions

From: "jan.nijtmans" <[email-masked]>
Date: Mon, 11 Feb 2013 10:25:04 +0000

---
 generic/tclMain.c       |  4 ++--
 generic/tclOOBasic.c    |  2 +-
 generic/tclOOInfo.c     | 22 +++++++++++-----------
 generic/tclObj.c        | 10 +++++-----
 generic/tclThreadTest.c |  4 ++--
 generic/tclTrace.c      |  2 +-
 generic/tclUtil.c       |  2 +-
 generic/tclZlib.c       |  6 +++---
 macosx/tclMacOSXFCmd.c  |  2 +-
 tools/tsdPerf.c         |  2 +-
 unix/dltest/pkga.c      |  2 +-
 unix/dltest/pkgb.c      |  2 +-
 unix/dltest/pkgc.c      |  2 +-
 unix/dltest/pkgd.c      |  2 +-
 unix/dltest/pkgua.c     |  2 +-
 unix/tclUnixFCmd.c      |  6 +++---
 unix/tclUnixPipe.c      |  4 ++--
 win/tclWinDde.c         |  2 +-
 win/tclWinFCmd.c        |  2 +-
 win/tclWinReg.c         |  4 ++--
 win/tclWinTest.c        |  8 ++++----
 21 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/generic/tclMain.c b/generic/tclMain.c
index 1b15617..63e7464 100644
--- a/generic/tclMain.c
+++ b/generic/tclMain.c
@@ -362,7 +362,7 @@ Tcl_MainEx(
     argc--;
     argv++;
 
-    Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewIntObj(argc), TCL_GLOBAL_ONLY);
+    Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewLongObj(argc), TCL_GLOBAL_ONLY);
 
     argvPtr = Tcl_NewListObj(0, NULL);
     while (argc--) {
@@ -376,7 +376,7 @@ Tcl_MainEx(
 
     is.tty = isatty(0);
     Tcl_SetVar2Ex(interp, "tcl_interactive", NULL,
-	    Tcl_NewIntObj(!path && is.tty), TCL_GLOBAL_ONLY);
+	    Tcl_NewLongObj(!path && is.tty), TCL_GLOBAL_ONLY);
 
     /*
      * Invoke application-specific initialization.
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c
index 617be35..5e29512 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.c
@@ -1148,7 +1148,7 @@ TclOOSelfObjCmd(
 	}
     case SELF_CALL:
 	result[0] = TclOORenderCallChain(interp, contextPtr->callPtr);
-	result[1] = Tcl_NewIntObj(contextPtr->index);
+	result[1] = Tcl_NewLongObj(contextPtr->index);
 	Tcl_SetObjResult(interp, Tcl_NewListObj(2, result));
 	return TCL_OK;
     }
diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c
index 3217f98..cbf49d3 100644
--- a/generic/tclOOInfo.c
+++ b/generic/tclOOInfo.c
@@ -197,11 +197,11 @@ InfoObjectClassCmd(
 
 	FOREACH(mixinPtr, oPtr->mixins) {
 	    if (TclOOIsReachable(o2clsPtr, mixinPtr)) {
-		Tcl_SetObjResult(interp, Tcl_NewIntObj(1));
+		Tcl_SetObjResult(interp, Tcl_NewLongObj(1));
 		return TCL_OK;
 	    }
 	}
-	Tcl_SetObjResult(interp, Tcl_NewIntObj(
+	Tcl_SetObjResult(interp, Tcl_NewLongObj(
 		TclOOIsReachable(o2clsPtr, oPtr->selfCls)));
 	return TCL_OK;
     }
@@ -418,7 +418,7 @@ InfoObjectIsACmd(
 	if (!ok) {
 	    Tcl_ResetResult(interp);
 	}
-	Tcl_SetObjResult(interp, Tcl_NewIntObj(ok ? 1 : 0));
+	Tcl_SetObjResult(interp, Tcl_NewLongObj(ok!=0));
 	return TCL_OK;
     }
     oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[2]);
@@ -432,7 +432,7 @@ InfoObjectIsACmd(
 	    Tcl_WrongNumArgs(interp, 2, objv, "objName");
 	    return TCL_ERROR;
 	}
-	Tcl_SetObjResult(interp, Tcl_NewIntObj(oPtr->classPtr ? 1 : 0));
+	Tcl_SetObjResult(interp, Tcl_NewLongObj(oPtr->classPtr!=NULL));
 	return TCL_OK;
     case IsMetaclass:
 	if (objc != 3) {
@@ -440,12 +440,12 @@ InfoObjectIsACmd(
 	    return TCL_ERROR;
 	}
 	if (oPtr->classPtr == NULL) {
-	    Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
+	    Tcl_SetObjResult(interp, Tcl_NewLongObj(0));
 	} else {
 	    Class *classCls = TclOOGetFoundation(interp)->classCls;
 
-	    Tcl_SetObjResult(interp, Tcl_NewIntObj(
-		    TclOOIsReachable(classCls, oPtr->classPtr) ? 1 : 0));
+	    Tcl_SetObjResult(interp, Tcl_NewLongObj(
+		    TclOOIsReachable(classCls, oPtr->classPtr)!=0));
 	}
 	return TCL_OK;
     case IsMixin:
@@ -467,12 +467,12 @@ InfoObjectIsACmd(
 
 	    FOREACH(mixinPtr, oPtr->mixins) {
 		if (mixinPtr == o2Ptr->classPtr) {
-		    Tcl_SetObjResult(interp, Tcl_NewIntObj(1));
+		    Tcl_SetObjResult(interp, Tcl_NewLongObj(1));
 		    return TCL_OK;
 		}
 	    }
 	}
-	Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
+	Tcl_SetObjResult(interp, Tcl_NewLongObj(0));
 	return TCL_OK;
     case IsType:
 	if (objc != 4) {
@@ -490,9 +490,9 @@ InfoObjectIsACmd(
 	    return TCL_ERROR;
 	}
 	if (TclOOIsReachable(o2Ptr->classPtr, oPtr->selfCls)) {
-	    Tcl_SetObjResult(interp, Tcl_NewIntObj(1));
+	    Tcl_SetObjResult(interp, Tcl_NewLongObj(1));
 	} else {
-	    Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
+	    Tcl_SetObjResult(interp, Tcl_NewLongObj(0));
 	}
 	return TCL_OK;
     case IsObject:
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 5c8ff47..bf98b35 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -2396,11 +2396,11 @@ Tcl_NewLongObj(
  * Tcl_DbNewLongObj --
  *
  *	If a client is compiled with TCL_MEM_DEBUG defined, calls to
- *	Tcl_NewIntObj and Tcl_NewLongObj to create new integer or long integer
- *	objects end up calling the debugging function Tcl_DbNewLongObj
- *	instead. We provide two implementations of Tcl_DbNewLongObj so that
- *	whether the Tcl core is compiled to do memory debugging of the core is
- *	independent of whether a client requests debugging for itself.
+ *	Tcl_NewLongObj to create new long integer objects end up calling the
+ *	debugging function Tcl_DbNewLongObj instead. We provide two
+ *	implementations of Tcl_DbNewLongObj so that whether the Tcl core is
+ *	compiled to do memory debugging of the core is independent of whether
+ *	a client requests debugging for itself.
  *
  *	When the core is compiled with TCL_MEM_DEBUG defined, Tcl_DbNewLongObj
  *	calls Tcl_DbCkalloc directly with the file name and line number from
diff --git a/generic/tclThreadTest.c b/generic/tclThreadTest.c
index d76a4f3..ccf5101 100644
--- a/generic/tclThreadTest.c
+++ b/generic/tclThreadTest.c
@@ -368,7 +368,7 @@ ThreadObjCmd(
 
 	result = Tcl_JoinThread((Tcl_ThreadId)(size_t)id, &status);
 	if (result == TCL_OK) {
-	    Tcl_SetIntObj(Tcl_GetObjResult(interp), status);
+	    Tcl_SetLongObj(Tcl_GetObjResult(interp), status);
 	} else {
 	    char buf[20];
 
@@ -415,7 +415,7 @@ ThreadObjCmd(
 	    Tcl_WrongNumArgs(interp, 2, objv, NULL);
 	    return TCL_ERROR;
 	}
-	Tcl_SetObjResult(interp, Tcl_NewIntObj(
+	Tcl_SetObjResult(interp, Tcl_NewLongObj(
 		Tcl_DoOneEvent(TCL_ALL_EVENTS | TCL_DONT_WAIT)));
 	return TCL_OK;
     }
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index 82d652c..cdebe03 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -1845,7 +1845,7 @@ TraceExecutionProc(
 		 * Append result code.
 		 */
 
-		resultCode = Tcl_NewIntObj(code);
+		resultCode = Tcl_NewLongObj(code);
 		resultCodeStr = Tcl_GetString(resultCode);
 		Tcl_DStringAppendElement(&cmd, resultCodeStr);
 		Tcl_DecrRefCount(resultCode);
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 54bca25..bcfdc2a 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -3128,7 +3128,7 @@ TclPrecTraceProc(

     if (flags & TCL_TRACE_READS) {
-	Tcl_SetVar2Ex(interp, name1, name2, Tcl_NewLongObj(*precisionPtr!=0),
+	Tcl_SetVar2Ex(interp, name1, name2, Tcl_NewLongObj(*precisionPtr),
 		flags & TCL_GLOBAL_ONLY);
 	return NULL;
     }
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index aa57d40..93e5af4 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -545,7 +545,7 @@ ExtractHeader(
 		&tmp);
 	SetValue(dictObj, "comment", TclDStringToObj(&tmp));
     }
-    SetValue(dictObj, "crc", Tcl_NewBooleanObj(headerPtr->hcrc));
+    SetValue(dictObj, "crc", Tcl_NewLongObj(headerPtr->hcrc!=0));
     if (headerPtr->name != Z_NULL) {
 	if (latin1enc == NULL) {
 	    /*
@@ -563,7 +563,7 @@ ExtractHeader(
 	SetValue(dictObj, "filename", TclDStringToObj(&tmp));
     }
     if (headerPtr->os != 255) {
-	SetValue(dictObj, "os", Tcl_NewIntObj(headerPtr->os));
+	SetValue(dictObj, "os", Tcl_NewLongObj(headerPtr->os));
     }
     if (headerPtr->time != 0 /* magic - no time */) {
 	SetValue(dictObj, "time", Tcl_NewLongObj((long) headerPtr->time));
@@ -2581,7 +2581,7 @@ ZlibStreamCmd(
 	    Tcl_WrongNumArgs(interp, 2, objv, NULL);
 	    return TCL_ERROR;
 	}
-	Tcl_SetObjResult(interp, Tcl_NewIntObj(Tcl_ZlibStreamEof(zstream)));
+	Tcl_SetObjResult(interp, Tcl_NewLongObj(Tcl_ZlibStreamEof(zstream)));
 	return TCL_OK;
     case zs_checksum:		/* $strm checksum */
 	if (objc != 2) {
diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c
index 8ecfd0b..d16f33f 100644
--- a/macosx/tclMacOSXFCmd.c
+++ b/macosx/tclMacOSXFCmd.c
@@ -192,7 +192,7 @@ TclMacOSXGetFileAttribute(
 		OSSwapBigToHostInt32(finder->type));
 	break;
     case MACOSX_HIDDEN_ATTRIBUTE:
-	*attributePtrPtr = Tcl_NewBooleanObj(
+	*attributePtrPtr = Tcl_NewLongObj(
 		(finder->fdFlags & kFinfoIsInvisible) != 0);
 	break;
     case MACOSX_RSRCLENGTH_ATTRIBUTE:
diff --git a/tools/tsdPerf.c b/tools/tsdPerf.c
index 40004b1..e1ac552 100644
--- a/tools/tsdPerf.c
+++ b/tools/tsdPerf.c
@@ -33,7 +33,7 @@ tsdPerfGetObjCmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const
     TsdPerf *perf = Tcl_GetThreadData(&key, sizeof(TsdPerf));

-    Tcl_SetObjResult(interp, Tcl_NewIntObj(perf->value));
+    Tcl_SetObjResult(interp, Tcl_NewLongObj(perf->value));
 
     return TCL_OK;
 }
diff --git a/unix/dltest/pkga.c b/unix/dltest/pkga.c
index afa346a..d21ef95 100644
--- a/unix/dltest/pkga.c
+++ b/unix/dltest/pkga.c
@@ -62,7 +62,7 @@ Pkga_EqObjCmd(
     } else {
 	result = 0;
     }
-    Tcl_SetObjResult(interp, Tcl_NewIntObj(result));
+    Tcl_SetObjResult(interp, Tcl_NewLongObj(result));
     return TCL_OK;
 }
 
diff --git a/unix/dltest/pkgb.c b/unix/dltest/pkgb.c
index b32092c..591e225 100644
--- a/unix/dltest/pkgb.c
+++ b/unix/dltest/pkgb.c
@@ -65,7 +65,7 @@ Pkgb_SubObjCmd(
 	Tcl_AppendResult(interp, " in line: ", buf, NULL);
 	return TCL_ERROR;
     }
-    Tcl_SetObjResult(interp, Tcl_NewIntObj(first - second));
+    Tcl_SetObjResult(interp, Tcl_NewLongObj(first - second));
     return TCL_OK;
 }
 
diff --git a/unix/dltest/pkgc.c b/unix/dltest/pkgc.c
index c76c2d2..a1d9ba0 100644
--- a/unix/dltest/pkgc.c
+++ b/unix/dltest/pkgc.c
@@ -56,7 +56,7 @@ Pkgc_SubObjCmd(
 	    || (Tcl_GetIntFromObj(interp, objv[2], &second) != TCL_OK)) {
 	return TCL_ERROR;
     }
-    Tcl_SetObjResult(interp, Tcl_NewIntObj(first - second));
+    Tcl_SetObjResult(interp, Tcl_NewLongObj(first - second));
     return TCL_OK;
 }
 
diff --git a/unix/dltest/pkgd.c b/unix/dltest/pkgd.c
index ae9ff93..3718dfb 100644
--- a/unix/dltest/pkgd.c
+++ b/unix/dltest/pkgd.c
@@ -56,7 +56,7 @@ Pkgd_SubObjCmd(
 	    || (Tcl_GetIntFromObj(interp, objv[2], &second) != TCL_OK)) {
 	return TCL_ERROR;
     }
-    Tcl_SetObjResult(interp, Tcl_NewIntObj(first - second));
+    Tcl_SetObjResult(interp, Tcl_NewLongObj(first - second));
     return TCL_OK;
 }
 
diff --git a/unix/dltest/pkgua.c b/unix/dltest/pkgua.c
index b92b320..a320bce 100644
--- a/unix/dltest/pkgua.c
+++ b/unix/dltest/pkgua.c
@@ -138,7 +138,7 @@ PkguaEqObjCmd(
     } else {
 	result = 0;
     }
-    Tcl_SetObjResult(interp, Tcl_NewIntObj(result));
+    Tcl_SetObjResult(interp, Tcl_NewLongObj(result));
     return TCL_OK;
 }
 
diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c
index d9952b9..3c6d3f9 100644
--- a/unix/tclUnixFCmd.c
+++ b/unix/tclUnixFCmd.c
@@ -1338,7 +1338,7 @@ GetGroupAttribute(
     groupPtr = TclpGetGrGid(statBuf.st_gid);
 
     if (groupPtr == NULL) {
-	*attributePtrPtr = Tcl_NewIntObj((int) statBuf.st_gid);
+	*attributePtrPtr = Tcl_NewLongObj((long) statBuf.st_gid);
     } else {
 	Tcl_DString ds;
 	const char *utf;
@@ -1392,7 +1392,7 @@ GetOwnerAttribute(
     pwPtr = TclpGetPwUid(statBuf.st_uid);
 
     if (pwPtr == NULL) {
-	*attributePtrPtr = Tcl_NewIntObj((int) statBuf.st_uid);
+	*attributePtrPtr = Tcl_NewLongObj((long) statBuf.st_uid);
     } else {
 	Tcl_DString ds;
 
@@ -2283,7 +2283,7 @@ GetReadOnlyAttribute(
 	return TCL_ERROR;
     }
 
-    *attributePtrPtr = Tcl_NewBooleanObj(statBuf.st_flags&UF_IMMUTABLE);
+    *attributePtrPtr = Tcl_NewLongObj((statBuf.st_flags&UF_IMMUTABLE)!=0);
 
     return TCL_OK;
 }
diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c
index ce73751..ac9ba77 100644
--- a/unix/tclUnixPipe.c
+++ b/unix/tclUnixPipe.c
@@ -870,7 +870,7 @@ TclGetAndDetachPids(
     pipePtr = Tcl_GetChannelInstanceData(chan);
     TclNewObj(pidsObj);
     for (i = 0; i < pipePtr->numPids; i++) {
-	Tcl_ListObjAppendElement(NULL, pidsObj, Tcl_NewIntObj(
+	Tcl_ListObjAppendElement(NULL, pidsObj, Tcl_NewLongObj(
 		PTR2INT(pipePtr->pidPtr[i])));
 	Tcl_DetachPids(1, &pipePtr->pidPtr[i]);
     }
@@ -1288,7 +1288,7 @@ Tcl_PidObjCmd(
 	resultPtr = Tcl_NewObj();
 	for (i = 0; i < pipePtr->numPids; i++) {
 	    Tcl_ListObjAppendElement(NULL, resultPtr,
-		    Tcl_NewIntObj(PTR2INT(TclpGetPid(pipePtr->pidPtr[i]))));
+		    Tcl_NewLongObj(PTR2INT(TclpGetPid(pipePtr->pidPtr[i]))));
 	}
 	Tcl_SetObjResult(interp, resultPtr);
     }
diff --git a/win/tclWinDde.c b/win/tclWinDde.c
index 013b320..10876ed 100644
--- a/win/tclWinDde.c
+++ b/win/tclWinDde.c
@@ -568,7 +568,7 @@ ExecuteRemoteObject(
     returnPackagePtr = Tcl_NewListObj(0, NULL);
 
     Tcl_ListObjAppendElement(NULL, returnPackagePtr,
-	    Tcl_NewIntObj(result));
+	    Tcl_NewLongObj(result));
     Tcl_ListObjAppendElement(NULL, returnPackagePtr,
 	    Tcl_GetObjResult(riPtr->interp));
 
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index ac88861..db5ed9e 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.c
@@ -1607,7 +1607,7 @@ GetWinFileAttributes(
 	}
     }
 
-    *attributePtrPtr = Tcl_NewBooleanObj(attr);
+    *attributePtrPtr = Tcl_NewLongObj(attr!=0);
     return TCL_OK;
 }
 
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index 643bd06..15ca183 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.c
@@ -693,7 +693,7 @@ GetType(
      */
 
     if (type > lastType) {
-	Tcl_SetObjResult(interp, Tcl_NewIntObj((int) type));
+	Tcl_SetObjResult(interp, Tcl_NewLongObj((int) type));
     } else {
 	Tcl_SetObjResult(interp, Tcl_NewStringObj(typeNames[type], -1));
     }
@@ -791,7 +791,7 @@ GetValue(
      */
 
     if (type == REG_DWORD || type == REG_DWORD_BIG_ENDIAN) {
-	Tcl_SetObjResult(interp, Tcl_NewIntObj((int) ConvertDWORD(type,
+	Tcl_SetObjResult(interp, Tcl_NewLongObj((long) ConvertDWORD(type,
 		*((DWORD *) Tcl_DStringValue(&data)))));
     } else if (type == REG_MULTI_SZ) {
 	char *p = Tcl_DStringValue(&data);
diff --git a/win/tclWinTest.c b/win/tclWinTest.c
index e046bd3..17b76b8 100644
--- a/win/tclWinTest.c
+++ b/win/tclWinTest.c
@@ -277,11 +277,11 @@ TestwinclockCmd(
 
     result = Tcl_NewObj();
     Tcl_ListObjAppendElement(interp, result,
-	    Tcl_NewIntObj((int) (t2.QuadPart / 10000000)));
+	    Tcl_NewLongObj((int) (t2.QuadPart / 10000000)));
     Tcl_ListObjAppendElement(interp, result,
-	    Tcl_NewIntObj((int) ((t2.QuadPart / 10) % 1000000)));
-    Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(tclTime.sec));
-    Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(tclTime.usec));
+	    Tcl_NewLongObj((int) ((t2.QuadPart / 10) % 1000000)));
+    Tcl_ListObjAppendElement(interp, result, Tcl_NewLongObj(tclTime.sec));
+    Tcl_ListObjAppendElement(interp, result, Tcl_NewLongObj(tclTime.usec));
 
     Tcl_ListObjAppendElement(interp, result, Tcl_NewWideIntObj(p1.QuadPart));
     Tcl_ListObjAppendElement(interp, result, Tcl_NewWideIntObj(p2.QuadPart));
-- 
cgit v0.12