diff options
author | dgp <dgp@users.sourceforge.net> | 2020-01-05 19:03:12 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2020-01-05 19:03:12 (GMT) |
commit | a75f6ac8ce9148d70852d4a6b749a42af19c6562 (patch) | |
tree | 0a59802a6c825eeff50fab634aeda68dceaf9865 /generic/tclResult.c | |
parent | ac2be8e353082ec64280e2c2f429ace57f674d37 (diff) | |
download | tcl-a75f6ac8ce9148d70852d4a6b749a42af19c6562.zip tcl-a75f6ac8ce9148d70852d4a6b749a42af19c6562.tar.gz tcl-a75f6ac8ce9148d70852d4a6b749a42af19c6562.tar.bz2 |
Fix documentation, comments, and argument names of Tcl_TransferResult().
Diffstat (limited to 'generic/tclResult.c')
-rw-r--r-- | generic/tclResult.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/generic/tclResult.c b/generic/tclResult.c index 9d0714c..bdb3912 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -1682,22 +1682,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. @@ -1707,14 +1699,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. */ { @@ -1725,7 +1719,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. @@ -1737,7 +1731,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)); |