summaryrefslogtreecommitdiffstats
path: root/generic/tclLink.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-01-31 13:15:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-01-31 13:15:40 (GMT)
commita5fff7a94743517ada1b332a259ccfa63bb89570 (patch)
tree78358717cd6d954f952f00959a735a33fedbef8d /generic/tclLink.c
parent7fcf2e495ebdd49002ba5bfa74c2aa5d97e7c50a (diff)
downloadtcl-a5fff7a94743517ada1b332a259ccfa63bb89570.zip
tcl-a5fff7a94743517ada1b332a259ccfa63bb89570.tar.gz
tcl-a5fff7a94743517ada1b332a259ccfa63bb89570.tar.bz2
Update documentation on recent changes in Tcl_LinkVar.
Don't use TCL_NO_DEPRECATED for disabling tests-cases: Those were not deprecated in 8.6 yet. Minor code clean-up. No functional changes.
Diffstat (limited to 'generic/tclLink.c')
-rw-r--r--generic/tclLink.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/generic/tclLink.c b/generic/tclLink.c
index 6741377..f8f2342 100644
--- a/generic/tclLink.c
+++ b/generic/tclLink.c
@@ -575,7 +575,7 @@ LinkTraceProc(
break;
case TCL_LINK_STRING:
- value = Tcl_GetStringFromObj(valueObj, &valueLength);
+ value = TclGetStringFromObj(valueObj, &valueLength);
valueLength++;
pp = (char **) linkPtr->addr;
@@ -722,23 +722,22 @@ SetInvalidRealFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr) {
/*
* This function checks for integer representations, which are valid
* when linking with C variables, but which are invalid in other
- * contexts in Tcl. Handled are "", "+", "-", "0x", "0b" and "0o"
+ * contexts in Tcl. Handled are "+", "-", "", "0x", "0b" and "0o"
* (upperand lowercase). See bug [39f6304c2e].
*/
int
GetInvalidIntFromObj(Tcl_Obj *objPtr,
int *intPtr)
{
- int length;
- const char *str = TclGetStringFromObj(objPtr, &length);
+ const char *str = TclGetString(objPtr);
- if ((length == 1) && strchr("+-", str[0])) {
- *intPtr = (str[0] == '+');
- return TCL_OK;
- } else if ((length == 0) ||
- ((length == 2) && (str[0] == '0') && strchr("xXbBoO", str[1]))) {
+ if ((objPtr->length == 0) ||
+ ((objPtr->length == 2) && (str[0] == '0') && strchr("xXbBoO", str[1]))) {
*intPtr = 0;
return TCL_OK;
+ } else if ((objPtr->length == 1) && strchr("+-", str[0])) {
+ *intPtr = (str[0] == '+');
+ return TCL_OK;
}
return TCL_ERROR;
}
@@ -746,25 +745,28 @@ GetInvalidIntFromObj(Tcl_Obj *objPtr,
/*
* This function checks for double representations, which are valid
* when linking with C variables, but which are invalid in other
- * contexts in Tcl. Handled are ".", "+", "-", "0x", "0b" and "0o"
+ * contexts in Tcl. Handled are "+", "-", "", ".", "0x", "0b" and "0o"
* (upper- and lowercase) and sequences like "1e-". See bug [39f6304c2e].
*/
int
GetInvalidDoubleFromObj(Tcl_Obj *objPtr,
double *doublePtr)
{
- int intValue, result;
+ int intValue;
- if ((objPtr->typePtr == &invalidRealType) ||
- (SetInvalidRealFromAny(NULL, objPtr) == TCL_OK)) {
- *doublePtr = objPtr->internalRep.doubleValue;
- return TCL_OK;
+ if (objPtr->typePtr == &invalidRealType) {
+ goto gotdouble;
}
- result = GetInvalidIntFromObj(objPtr, &intValue);
- if (result == TCL_OK) {
+ if (GetInvalidIntFromObj(objPtr, &intValue) == TCL_OK) {
*doublePtr = (double) intValue;
+ return TCL_OK;
+ }
+ if (SetInvalidRealFromAny(NULL, objPtr) == TCL_OK) {
+ gotdouble:
+ *doublePtr = objPtr->internalRep.doubleValue;
+ return TCL_OK;
}
- return result;
+ return TCL_ERROR;
}
/*