diff options
| author | dkf <donal.k.fellows@manchester.ac.uk> | 2021-04-23 20:24:00 (GMT) |
|---|---|---|
| committer | dkf <donal.k.fellows@manchester.ac.uk> | 2021-04-23 20:24:00 (GMT) |
| commit | aa6c33b39d6959069884cf1ff5dbbebb731b33f1 (patch) | |
| tree | 4a05ac02975d15287cb0877f07b86c80b1326b4d | |
| parent | 52b58d0c7d1575d7c784ccb344862e0de8a9686b (diff) | |
| download | tcl-aa6c33b39d6959069884cf1ff5dbbebb731b33f1.zip tcl-aa6c33b39d6959069884cf1ff5dbbebb731b33f1.tar.gz tcl-aa6c33b39d6959069884cf1ff5dbbebb731b33f1.tar.bz2 | |
Start of documenting our reference count management
| -rw-r--r-- | doc/AddErrInfo.3 | 16 | ||||
| -rw-r--r-- | doc/BoolObj.3 | 12 |
2 files changed, 28 insertions, 0 deletions
diff --git a/doc/AddErrInfo.3 b/doc/AddErrInfo.3 index 5b0fe5a..d04b4c9 100644 --- a/doc/AddErrInfo.3 +++ b/doc/AddErrInfo.3 @@ -308,6 +308,22 @@ The global variables \fBerrorInfo\fR and \fBerrorCode\fR are not modified by \fBTcl_ResetResult\fR so they continue to hold a record of information about the most recent error seen in an interpreter. +.SH "REFERENCE COUNT MANAGEMENT" +.PP +The result of \fBTcl_GetReturnOptions\fR will have at least one +reference to it from the Tcl interpreter. If not using it immediately, +you should use \fBTcl_IncrRefCount\fR to add your own reference. +.PP +The \fIoptions\fR argument to \fBTcl_SetReturnOptions\fR will have a +reference added by the Tcl interpreter; it may safely be called with a +zero-reference value. +.PP +\fBTcl_AppendObjToErrorInfo\fR only reads its \fIobjPtr\fR argument; +it does not modify its reference count at all. +.PP +The \fIerrorObjPtr\fR argument to \fBTcl_SetObjErrorCode\fR will have a +reference added by the Tcl interpreter; it may safely be called with a +zero-reference value. .SH "SEE ALSO" Tcl_DecrRefCount(3), Tcl_IncrRefCount(3), Tcl_Interp(3), Tcl_ResetResult(3), Tcl_SetErrno(3), errorCode(n), errorInfo(n) diff --git a/doc/BoolObj.3 b/doc/BoolObj.3 index 7268e1f..9bbdc7e 100644 --- a/doc/BoolObj.3 +++ b/doc/BoolObj.3 @@ -88,6 +88,18 @@ will lead to a \fBTCL_OK\fR return (and the boolean value 1), while the same value passed to \fBTcl_GetBoolean\fR will lead to a \fBTCL_ERROR\fR return. +.SH "REFERENCE COUNT MANAGEMENT" +.PP +\fBTcl_NewBooleanObj\fR always returns a zero-reference object, much +like \fBTcl_NewObj\fR. +.PP +\fBTcl_SetBooleanObj\fR does not modify the reference count of its +\fIobjPtr\fR argument, but does require that the object be unshared. +.PP +\fBTcl_GetBooleanFromObj\fR does not modify the reference count of its +\fIobjPtr\fR argument; it only reads. Note however that this function +may set the interpreter result; if that is the only place that +is holding a reference to the object, it will be deleted. .SH "SEE ALSO" Tcl_NewObj, Tcl_IsShared, Tcl_GetBoolean |
