summaryrefslogtreecommitdiffstats
path: root/generic/tclResult.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-01-15 15:49:46 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-01-15 15:49:46 (GMT)
commit7ed7fa90ffa88ab4144d20e91139e6f36abdf133 (patch)
tree6233d2b913eba2a00298d1ede66c3d49a321d5c6 /generic/tclResult.c
parentb8c310c91a436e8514cc19a4fe75c124d5444286 (diff)
parenta72376335b62d075c3d7d92870af01c361da518e (diff)
downloadtcl-7ed7fa90ffa88ab4144d20e91139e6f36abdf133.zip
tcl-7ed7fa90ffa88ab4144d20e91139e6f36abdf133.tar.gz
tcl-7ed7fa90ffa88ab4144d20e91139e6f36abdf133.tar.bz2
Merge trunk. Fix MSVC static build
Diffstat (limited to 'generic/tclResult.c')
-rw-r--r--generic/tclResult.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/generic/tclResult.c b/generic/tclResult.c
index aa2bad7..3ca3c7b 100644
--- a/generic/tclResult.c
+++ b/generic/tclResult.c
@@ -1155,22 +1155,14 @@ Tcl_SetReturnOptions(
*
* Tcl_TransferResult --
*
- * Copy the result (and error information) from one interp to another.
+ * Transfer the result (and error information) from one interp to another.
* Used when one interp has caused another interp to evaluate a script
* and then wants to transfer the results back to itself.
*
- * This routine copies the string reps of the result and error
- * information. It does not simply increment the refcounts of the result
- * and error information objects themselves. It is not legal to exchange
- * objects between interps, because an object may be kept alive by one
- * interp, but have an internal rep that is only valid while some other
- * interp is alive.
- *
* Results:
- * The target interp's result is set to a copy of the source interp's
- * result. The source's errorInfo field may be transferred to the
- * target's errorInfo field, and the source's errorCode field may be
- * transferred to the target's errorCode field.
+ * The result of targetInterp is set to the result read from sourceInterp.
+ * The return options dictionary of sourceInterp is transferred to
+ * targetInterp as appropriate for the return code value code.
*
* Side effects:
* None.
@@ -1180,14 +1172,16 @@ Tcl_SetReturnOptions(
void
Tcl_TransferResult(
- Tcl_Interp *sourceInterp, /* Interp whose result and error information
+ Tcl_Interp *sourceInterp, /* Interp whose result and return options
* should be moved to the target interp.
* After moving result, this interp's result
* is reset. */
- int result, /* TCL_OK if just the result should be copied,
- * TCL_ERROR if both the result and error
- * information should be copied. */
- Tcl_Interp *targetInterp) /* Interp where result and error information
+ int code, /* The return code value active in
+ * sourceInterp. Controls how the return options
+ * dictionary is retrieved from sourceInterp,
+ * same as in Tcl_GetReturnOptions, to then be
+ * transferred to targetInterp. */
+ Tcl_Interp *targetInterp) /* Interp where result and return options
* should be stored. If source and target are
* the same, nothing is done. */
{
@@ -1198,7 +1192,7 @@ Tcl_TransferResult(
return;
}
- if (result == TCL_OK && siPtr->returnOpts == NULL) {
+ if (code == TCL_OK && siPtr->returnOpts == NULL) {
/*
* Special optimization for the common case of normal command return
* code and no explicit return options.
@@ -1210,7 +1204,7 @@ Tcl_TransferResult(
}
} else {
Tcl_SetReturnOptions(targetInterp,
- Tcl_GetReturnOptions(sourceInterp, result));
+ Tcl_GetReturnOptions(sourceInterp, code));
tiPtr->flags &= ~(ERR_ALREADY_LOGGED);
}
Tcl_SetObjResult(targetInterp, Tcl_GetObjResult(sourceInterp));