summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-11-25 16:11:38 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-11-25 16:11:38 (GMT)
commitb816a585c00c97feca1b4516769ccf2769a58e02 (patch)
tree77a1bcad1ca6879eda9d8bfffc581640656aa39f
parentd6fedf785445439d2d54c58f3e9906b0d867cd88 (diff)
downloadtcl-b816a585c00c97feca1b4516769ccf2769a58e02.zip
tcl-b816a585c00c97feca1b4516769ccf2769a58e02.tar.gz
tcl-b816a585c00c97feca1b4516769ccf2769a58e02.tar.bz2
Tcl_NewDoubleObj -> TclNewDoubleObj and Tcl_NewWideIntObj -> TclNewIntObj (and similar). Gives more info when debugging
-rwxr-xr-xgeneric/tclArithSeries.c7
-rw-r--r--generic/tclClock.c12
-rw-r--r--generic/tclCmdIL.c6
-rw-r--r--generic/tclCmdMZ.c8
-rw-r--r--generic/tclCompExpr.c2
-rw-r--r--generic/tclInt.decls2
-rw-r--r--generic/tclIntDecls.h6
-rw-r--r--generic/tclLink.c7
-rw-r--r--generic/tclListObj.c14
-rw-r--r--generic/tclScan.c4
10 files changed, 34 insertions, 34 deletions
diff --git a/generic/tclArithSeries.c b/generic/tclArithSeries.c
index 5c4e5a5..40f34b5 100755
--- a/generic/tclArithSeries.c
+++ b/generic/tclArithSeries.c
@@ -390,9 +390,9 @@ TclArithSeriesObjStep(
}
arithSeriesRepPtr = ArithSeriesRepPtr(arithSeriesPtr);
if (arithSeriesRepPtr->isDouble) {
- *stepObj = Tcl_NewDoubleObj(((ArithSeriesDbl*)(arithSeriesRepPtr))->step);
+ TclNewDoubleObj(*stepObj, ((ArithSeriesDbl*)(arithSeriesRepPtr))->step);
} else {
- *stepObj = Tcl_NewWideIntObj(arithSeriesRepPtr->step);
+ TclNewIntObj(*stepObj, arithSeriesRepPtr->step);
}
return TCL_OK;
}
@@ -956,7 +956,8 @@ TclArithSeriesObjReverse(
if (Tcl_IsShared(arithSeriesPtr) ||
((arithSeriesPtr->refCount > 1))) {
- Tcl_Obj *lenObj = Tcl_NewWideIntObj(len);
+ Tcl_Obj *lenObj;
+ TclNewIntObj(lenObj, len);
if (TclNewArithSeriesObj(interp, &resultObj,
isDouble, startObj, endObj, stepObj, lenObj) != TCL_OK) {
resultObj = NULL;
diff --git a/generic/tclClock.c b/generic/tclClock.c
index a9ba70c..d1f08c1 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -14,6 +14,7 @@
*/
#include "tclInt.h"
+#include "tclTomMath.h"
/*
* Windows has mktime. The configurators do not check.
@@ -1804,14 +1805,16 @@ ClockMillisecondsObjCmd(
Tcl_Obj *const *objv) /* Parameter values */
{
Tcl_Time now;
+ Tcl_Obj *timeObj;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
}
Tcl_GetTime(&now);
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)
- now.sec * 1000 + now.usec / 1000));
+ TclNewUIntObj(timeObj, (Tcl_WideUInt)
+ now.sec * 1000 + now.usec / 1000);
+ Tcl_SetObjResult(interp, timeObj);
return TCL_OK;
}
@@ -1992,13 +1995,16 @@ ClockSecondsObjCmd(
Tcl_Obj *const *objv) /* Parameter values */
{
Tcl_Time now;
+ Tcl_Obj *timeObj;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
return TCL_ERROR;
}
Tcl_GetTime(&now);
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt) now.sec));
+ TclNewUIntObj(timeObj, (Tcl_WideUInt)now.sec);
+
+ Tcl_SetObjResult(interp, timeObj);
return TCL_OK;
}
diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c
index 4b7bd48..e2493c4 100644
--- a/generic/tclCmdIL.c
+++ b/generic/tclCmdIL.c
@@ -3607,7 +3607,7 @@ Tcl_LsearchObjCmd(
if (allMatches || inlineReturn) {
Tcl_ResetResult(interp);
} else {
- TclNewIndexObj(itemPtr, TCL_INDEX_NONE);
+ TclNewIntObj(itemPtr, -1);
Tcl_SetObjResult(interp, itemPtr);
}
goto done;
@@ -4103,10 +4103,10 @@ SequenceIdentifyArgument(
exprValueObj = argPtr;
} else {
if (floor(dvalue) == dvalue) {
- exprValueObj = Tcl_NewWideIntObj(value);
+ TclNewIntObj(exprValueObj, value);
keyword = TCL_NUMBER_INT;
} else {
- exprValueObj = Tcl_NewDoubleObj(dvalue);
+ TclNewDoubleObj(exprValueObj, dvalue);
keyword = TCL_NUMBER_DOUBLE;
}
}
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index b063689..57541f9 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -3775,7 +3775,7 @@ TclNRSwitchObjCmd(
TclNewIndexObj(rangeObjAry[0], info.matches[j].start);
TclNewIndexObj(rangeObjAry[1], info.matches[j].end-1);
} else {
- TclNewIndexObj(rangeObjAry[1], TCL_INDEX_NONE);
+ TclNewIntObj(rangeObjAry[1], -1);
rangeObjAry[0] = rangeObjAry[1];
}
@@ -4099,9 +4099,9 @@ Tcl_TimeObjCmd(
* Use int obj since we know time is not fractional. [Bug 1202178]
*/
- objs[0] = Tcl_NewWideIntObj((count <= 0) ? 0 : (Tcl_WideInt)totalMicroSec);
+ TclNewIntObj(objs[0], (count <= 0) ? 0 : (Tcl_WideInt)totalMicroSec);
} else {
- objs[0] = Tcl_NewDoubleObj(totalMicroSec/count);
+ TclNewDoubleObj(objs[0], totalMicroSec/count);
}
/*
@@ -4586,7 +4586,7 @@ Tcl_TimeRateObjCmd(
if (measureOverhead > ((double) usec) / count) {
measureOverhead = ((double) usec) / count;
}
- objs[0] = Tcl_NewDoubleObj(measureOverhead);
+ TclNewDoubleObj(objs[0], measureOverhead);
TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#-overhead"); /* mics */
objs += 2;
}
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 06b4b05..ded32aa 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -2787,7 +2787,7 @@ TclVariadicOpCmd(
nodes[1].p.parent = 0;
} else {
if (lexeme == DIVIDE) {
- litObjv[0] = Tcl_NewDoubleObj(1.0);
+ TclNewDoubleObj(litObjv[0], 1.0);
} else {
TclNewIntObj(litObjv[0], occdPtr->i.identity);
}
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index c0e0e06..b3e352a 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -701,7 +701,7 @@ declare 258 {
# TIP 625: for unit testing - create list objects with span
declare 260 {
- Tcl_Obj *TclListTestObj(int length, int leadingSpace, int endSpace)
+ Tcl_Obj *TclListTestObj(Tcl_Size length, Tcl_Size leadingSpace, Tcl_Size endSpace)
}
# TIP 625: for unit testing - check list invariants
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index 3da8567..4c8d897 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -660,8 +660,8 @@ EXTERN Tcl_Obj * TclpCreateTemporaryDirectory(Tcl_Obj *dirObj,
Tcl_Obj *basenameObj);
/* Slot 259 is reserved */
/* 260 */
-EXTERN Tcl_Obj * TclListTestObj(int length, int leadingSpace,
- int endSpace);
+EXTERN Tcl_Obj * TclListTestObj(Tcl_Size length,
+ Tcl_Size leadingSpace, Tcl_Size endSpace);
/* 261 */
EXTERN void TclListObjValidate(Tcl_Interp *interp,
Tcl_Obj *listObj);
@@ -930,7 +930,7 @@ typedef struct TclIntStubs {
void (*tclStaticLibrary) (Tcl_Interp *interp, const char *prefix, Tcl_LibraryInitProc *initProc, Tcl_LibraryInitProc *safeInitProc); /* 257 */
Tcl_Obj * (*tclpCreateTemporaryDirectory) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj); /* 258 */
void (*reserved259)(void);
- Tcl_Obj * (*tclListTestObj) (int length, int leadingSpace, int endSpace); /* 260 */
+ Tcl_Obj * (*tclListTestObj) (Tcl_Size length, Tcl_Size leadingSpace, Tcl_Size endSpace); /* 260 */
void (*tclListObjValidate) (Tcl_Interp *interp, Tcl_Obj *listObj); /* 261 */
} TclIntStubs;
diff --git a/generic/tclLink.c b/generic/tclLink.c
index cd2c731..f478a00 100644
--- a/generic/tclLink.c
+++ b/generic/tclLink.c
@@ -1282,7 +1282,7 @@ ObjValue(
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
objv = (Tcl_Obj **)ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
- objv[i] = Tcl_NewDoubleObj(linkPtr->lastValue.dPtr[i]);
+ TclNewDoubleObj(objv[i], linkPtr->lastValue.dPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
ckfree(objv);
@@ -1401,7 +1401,7 @@ ObjValue(
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
objv = (Tcl_Obj **)ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
- objv[i] = Tcl_NewDoubleObj(linkPtr->lastValue.fPtr[i]);
+ TclNewDoubleObj(objv[i], linkPtr->lastValue.fPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
ckfree(objv);
@@ -1414,8 +1414,7 @@ ObjValue(
memcpy(linkPtr->lastValue.aryPtr, linkPtr->addr, linkPtr->bytes);
objv = (Tcl_Obj **)ckalloc(linkPtr->numElems * sizeof(Tcl_Obj *));
for (i=0; i < linkPtr->numElems; i++) {
- TclNewUIntObj(objv[i],
- linkPtr->lastValue.uwPtr[i]);
+ TclNewUIntObj(objv[i], linkPtr->lastValue.uwPtr[i]);
}
resultObj = Tcl_NewListObj(linkPtr->numElems, objv);
ckfree(objv);
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 8ee0f48..486baa2 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -11,6 +11,7 @@
#include <assert.h>
#include "tclInt.h"
+#include "tclTomMath.h"
#include "tclArithSeries.h"
/*
@@ -3514,15 +3515,8 @@ UpdateStringOfList(
*------------------------------------------------------------------------
*/
Tcl_Obj *
-TclListTestObj (int length, int leadingSpace, int endSpace)
+TclListTestObj(Tcl_Size length, Tcl_Size leadingSpace, Tcl_Size endSpace)
{
- if (length < 0)
- length = 0;
- if (leadingSpace < 0)
- leadingSpace = 0;
- if (endSpace < 0)
- endSpace = 0;
-
ListRep listRep;
Tcl_Size capacity;
Tcl_Obj *listObj;
@@ -3538,9 +3532,9 @@ TclListTestObj (int length, int leadingSpace, int endSpace)
ListRepInit(capacity, NULL, 0, &listRep);
ListStore *storePtr = listRep.storePtr;
- int i;
+ Tcl_Size i;
for (i = 0; i < length; ++i) {
- storePtr->slots[i + leadingSpace] = Tcl_NewIntObj(i);
+ TclNewUIntObj(storePtr->slots[i + leadingSpace], i);
Tcl_IncrRefCount(storePtr->slots[i + leadingSpace]);
}
storePtr->firstUsed = leadingSpace;
diff --git a/generic/tclScan.c b/generic/tclScan.c
index 6bc914d..c200fa0 100644
--- a/generic/tclScan.c
+++ b/generic/tclScan.c
@@ -993,7 +993,7 @@ Tcl_ScanObjCmd(
* Scan a floating point number
*/
- objPtr = Tcl_NewDoubleObj(0.0);
+ TclNewDoubleObj(objPtr, 0.0);
Tcl_IncrRefCount(objPtr);
if (width == 0) {
width = ~0;
@@ -1090,7 +1090,7 @@ Tcl_ScanObjCmd(
if (code == TCL_OK) {
if (underflow && (nconversions == 0)) {
if (numVars) {
- TclNewIndexObj(objPtr, TCL_INDEX_NONE);
+ TclNewIntObj(objPtr, -1);
} else {
if (objPtr) {
Tcl_SetListObj(objPtr, 0, NULL);