summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-04-23 10:39:33 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-04-23 10:39:33 (GMT)
commitcb37c28cf9df9a8ebdca318c7f03f697e5b5ee7d (patch)
tree1bc0bc631c40f95af5a19d0b893abb7791875b17 /generic
parent9c56563bbe703e1bd7c267c6a43c8f62b978ae11 (diff)
downloadtcl-cb37c28cf9df9a8ebdca318c7f03f697e5b5ee7d.zip
tcl-cb37c28cf9df9a8ebdca318c7f03f697e5b5ee7d.tar.gz
tcl-cb37c28cf9df9a8ebdca318c7f03f697e5b5ee7d.tar.bz2
Implement Tcl_NewBooleanObj, Tcl_DbNewBooleanObj and Tcl_SetBooleanObj as macros using Tcl_NewIntObj, Tcl_DbNewLongObj and Tcl_SetIntObj.
Starting with Tcl 8.5, this is exactly the same, it only eliminates code duplication.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclDecls.h11
-rw-r--r--generic/tclObj.c10
2 files changed, 16 insertions, 5 deletions
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 30e305b..77402f8 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -6560,6 +6560,15 @@ extern TclStubs *tclStubsPtr;
#define Tcl_GetIndexFromObj(interp, objPtr, tablePtr, msg, flags, indexPtr) \
Tcl_GetIndexFromObjStruct(interp, objPtr, tablePtr, \
sizeof(char *), msg, flags, indexPtr)
+#undef Tcl_NewBooleanObj
+#define Tcl_NewBooleanObj(boolValue) \
+ Tcl_NewIntObj((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)
#undef Tcl_SetVar
#define Tcl_SetVar(interp, varName, newValue, flags) \
Tcl_SetVar2(interp, varName, NULL, newValue, flags)
@@ -6585,6 +6594,7 @@ extern TclStubs *tclStubsPtr;
/*
* Deprecated Tcl procedures:
*/
+
#undef Tcl_EvalObj
#define Tcl_EvalObj(interp,objPtr) \
Tcl_EvalObjEx((interp),(objPtr),0)
@@ -6593,4 +6603,3 @@ extern TclStubs *tclStubsPtr;
Tcl_EvalObjEx((interp),(objPtr),TCL_EVAL_GLOBAL)
#endif /* _TCLDECLS */
-
diff --git a/generic/tclObj.c b/generic/tclObj.c
index 96a4082..fb09a9e 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -1700,14 +1700,14 @@ Tcl_InvalidateStringRep(
*----------------------------------------------------------------------
*/
-#ifdef TCL_MEM_DEBUG
#undef Tcl_NewBooleanObj
+#ifdef TCL_MEM_DEBUG
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 */
@@ -1718,7 +1718,7 @@ Tcl_NewBooleanObj(
{
register Tcl_Obj *objPtr;
- TclNewBooleanObj(objPtr, boolValue);
+ TclNewIntObj(objPtr, boolValue!=0);
return objPtr;
}
#endif /* TCL_MEM_DEBUG */
@@ -1749,6 +1749,7 @@ Tcl_NewBooleanObj(
*----------------------------------------------------------------------
*/
+#undef Tcl_DbNewBooleanObj
#ifdef TCL_MEM_DEBUG
Tcl_Obj *
@@ -1801,6 +1802,7 @@ Tcl_DbNewBooleanObj(
*----------------------------------------------------------------------
*/
+#undef Tcl_SetBooleanObj
void
Tcl_SetBooleanObj(
register Tcl_Obj *objPtr, /* Object whose internal rep to init. */
@@ -1810,7 +1812,7 @@ Tcl_SetBooleanObj(
Tcl_Panic("%s called with shared object", "Tcl_SetBooleanObj");
}
- TclSetBooleanObj(objPtr, boolValue);
+ TclSetIntObj(objPtr, boolValue!=0);
}
/*