summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-03-13 08:38:18 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-03-13 08:38:18 (GMT)
commit084c8b2259399cfa7c22283d77abb1820207afad (patch)
tree88e761607718492f5525bd50f6afbb0fa84da34d
parent75196e7136a3ae04c019ee0dfa18309ff741cf86 (diff)
downloadtcl-084c8b2259399cfa7c22283d77abb1820207afad.zip
tcl-084c8b2259399cfa7c22283d77abb1820207afad.tar.gz
tcl-084c8b2259399cfa7c22283d77abb1820207afad.tar.bz2
Eliminate internal use of TclNewBooleanObj()/TclSetBooleanObj()/TclSetIntObj(). Replace Tcl_DbNewBooleanObj() with trivial macro.
-rw-r--r--generic/tcl.h2
-rw-r--r--generic/tclAssembly.c2
-rw-r--r--generic/tclDecls.h4
-rw-r--r--generic/tclExecute.c4
-rw-r--r--generic/tclInt.h26
-rw-r--r--generic/tclObj.c12
-rw-r--r--generic/tclStubInit.c2
7 files changed, 15 insertions, 37 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index c67eafc..1491745 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -2538,7 +2538,7 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr);
Tcl_DbNewBignumObj(val, __FILE__, __LINE__)
# undef Tcl_NewBooleanObj
# define Tcl_NewBooleanObj(val) \
- Tcl_DbNewBooleanObj(val, __FILE__, __LINE__)
+ Tcl_DbNewLongObj((val)!=0, __FILE__, __LINE__)
# undef Tcl_NewByteArrayObj
# define Tcl_NewByteArrayObj(bytes, len) \
Tcl_DbNewByteArrayObj(bytes, len, __FILE__, __LINE__)
diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c
index 2212d1c..8c6f81a 100644
--- a/generic/tclAssembly.c
+++ b/generic/tclAssembly.c
@@ -4246,7 +4246,7 @@ AddBasicBlockRangeToErrorInfo(
Tcl_AppendObjToErrorInfo(interp, lineNo);
Tcl_AddErrorInfo(interp, " and ");
if (bbPtr->successor1 != NULL) {
- Tcl_SetIntObj(lineNo, bbPtr->successor1->startLine);
+ TclSetLongObj(lineNo, bbPtr->successor1->startLine);
Tcl_AppendObjToErrorInfo(interp, lineNo);
} else {
Tcl_AddErrorInfo(interp, "end of assembly code");
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 0dbf345..fb7f8bc 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -3835,13 +3835,13 @@ extern const TclStubs *tclStubsPtr;
sizeof(char *), msg, flags, indexPtr)
#undef Tcl_NewBooleanObj
#define Tcl_NewBooleanObj(boolValue) \
- Tcl_NewIntObj((boolValue)!=0)
+ Tcl_NewLongObj((boolValue)!=0)
#undef Tcl_DbNewBooleanObj
#define Tcl_DbNewBooleanObj(boolValue, file, line) \
Tcl_DbNewLongObj((boolValue)!=0, file, line)
#undef Tcl_SetBooleanObj
#define Tcl_SetBooleanObj(objPtr, boolValue) \
- Tcl_SetIntObj((objPtr), (boolValue)!=0)
+ Tcl_SetLongObj((objPtr), (boolValue)!=0)
#undef Tcl_SetVar
#define Tcl_SetVar(interp, varName, newValue, flags) \
Tcl_SetVar2(interp, varName, NULL, newValue, flags)
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index c244b08..e3fa730 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -910,9 +910,9 @@ TclCreateExecEnv(
+ (size_t) (size-1) * sizeof(Tcl_Obj *));
eePtr->execStackPtr = esPtr;
- TclNewBooleanObj(eePtr->constants[0], 0);
+ TclNewLongObj(eePtr->constants[0], 0);
Tcl_IncrRefCount(eePtr->constants[0]);
- TclNewBooleanObj(eePtr->constants[1], 1);
+ TclNewLongObj(eePtr->constants[1], 1);
Tcl_IncrRefCount(eePtr->constants[1]);
eePtr->interp = interp;
eePtr->callbackPtr = NULL;
diff --git a/generic/tclInt.h b/generic/tclInt.h
index f078d18..9cca14a 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4516,9 +4516,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
* core. They should only be called on unshared objects. The ANSI C
* "prototypes" for these macros are:
*
- * MODULE_SCOPE void TclSetIntObj(Tcl_Obj *objPtr, int intValue);
* MODULE_SCOPE void TclSetLongObj(Tcl_Obj *objPtr, long longValue);
- * MODULE_SCOPE void TclSetBooleanObj(Tcl_Obj *objPtr, long boolValue);
* MODULE_SCOPE void TclSetWideIntObj(Tcl_Obj *objPtr, Tcl_WideInt w);
* MODULE_SCOPE void TclSetDoubleObj(Tcl_Obj *objPtr, double d);
*----------------------------------------------------------------
@@ -4532,19 +4530,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
(objPtr)->typePtr = &tclIntType; \
} while (0)
-#define TclSetIntObj(objPtr, l) \
- TclSetLongObj(objPtr, l)
-
-/*
- * NOTE: There is to be no such thing as a "pure" boolean. Boolean values set
- * programmatically go straight to being "int" Tcl_Obj's, with value 0 or 1.
- * The only "boolean" Tcl_Obj's shall be those holding the cached boolean
- * value of strings like: "yes", "no", "true", "false", "on", "off".
- */
-
-#define TclSetBooleanObj(objPtr, b) \
- TclSetLongObj(objPtr, (b)!=0);
-
#ifndef TCL_WIDE_INT_IS_LONG
#define TclSetWideIntObj(objPtr, w) \
do { \
@@ -4570,7 +4555,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
* the core. The ANSI C "prototypes" for these macros are:
*
* MODULE_SCOPE void TclNewLongObj(Tcl_Obj *objPtr, long l);
- * MODULE_SCOPE void TclNewBooleanObj(Tcl_Obj *objPtr, int b);
* MODULE_SCOPE void TclNewWideObj(Tcl_Obj *objPtr, Tcl_WideInt w);
* MODULE_SCOPE void TclNewDoubleObj(Tcl_Obj *objPtr, double d);
* MODULE_SCOPE void TclNewStringObj(Tcl_Obj *objPtr, const char *s, int len);
@@ -4591,13 +4575,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
TCL_DTRACE_OBJ_CREATE(objPtr); \
} while (0)
-/*
- * NOTE: There is to be no such thing as a "pure" boolean.
- * See comment above TclSetBooleanObj macro above.
- */
-#define TclNewBooleanObj(objPtr, b) \
- TclNewLongObj((objPtr), (b)!=0)
-
#define TclNewDoubleObj(objPtr, d) \
do { \
TclIncrObjsAllocated(); \
@@ -4623,9 +4600,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit;
#define TclNewLongObj(objPtr, l) \
(objPtr) = Tcl_NewLongObj(l)
-#define TclNewBooleanObj(objPtr, b) \
- (objPtr) = Tcl_NewBooleanObj(b)
-
#define TclNewDoubleObj(objPtr, d) \
(objPtr) = Tcl_NewDoubleObj(d)
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 7ec259f..bfef5fb 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -1732,7 +1732,7 @@ Tcl_InvalidateStringRep(
* is coerced to 1.
*
* When TCL_MEM_DEBUG is defined, this function just returns the result
- * of calling the debugging version Tcl_DbNewBooleanObj.
+ * of calling the debugging version Tcl_DbNewLongObj.
*
* Results:
* The newly created object is returned. This object will have an invalid
@@ -1751,7 +1751,7 @@ Tcl_Obj *
Tcl_NewBooleanObj(
register int boolValue) /* Boolean used to initialize new object. */
{
- return Tcl_DbNewBooleanObj(boolValue, "unknown", 0);
+ return Tcl_DbNewLongObj(boolValue!=0, "unknown", 0);
}
#else /* if not TCL_MEM_DEBUG */
@@ -1762,7 +1762,7 @@ Tcl_NewBooleanObj(
{
register Tcl_Obj *objPtr;
- TclNewBooleanObj(objPtr, boolValue);
+ TclNewLongObj(objPtr, boolValue!=0);
return objPtr;
}
#endif /* TCL_MEM_DEBUG */
@@ -1793,6 +1793,7 @@ Tcl_NewBooleanObj(
*----------------------------------------------------------------------
*/
+#ifndef TCL_NO_DEPRECATED
#undef Tcl_DbNewBooleanObj
#ifdef TCL_MEM_DEBUG
@@ -1827,6 +1828,7 @@ Tcl_DbNewBooleanObj(
return Tcl_NewBooleanObj(boolValue);
}
#endif /* TCL_MEM_DEBUG */
+#endif /* TCL_NO_DEPRECATED */
/*
*----------------------------------------------------------------------
@@ -1856,7 +1858,7 @@ Tcl_SetBooleanObj(
Tcl_Panic("%s called with shared object", "Tcl_SetBooleanObj");
}
- TclSetBooleanObj(objPtr, boolValue);
+ TclSetLongObj(objPtr, boolValue!=0);
}
/*
@@ -2458,7 +2460,7 @@ Tcl_SetIntObj(
Tcl_Panic("%s called with shared object", "Tcl_SetIntObj");
}
- TclSetIntObj(objPtr, intValue);
+ TclSetLongObj(objPtr, intValue);
}
/*
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 561b9dd..816650e 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -304,6 +304,8 @@ static int formatInt(char *buffer, int n){
# define Tcl_TellOld 0
# undef Tcl_SetResult
# define Tcl_SetResult 0
+# undef Tcl_DbNewBooleanObj
+# define Tcl_DbNewBooleanObj 0
#else /* TCL_NO_DEPRECATED */
# define Tcl_SeekOld seekOld
# define Tcl_TellOld tellOld