diff options
| -rw-r--r-- | doc/Object.3 | 8 | ||||
| -rw-r--r-- | doc/ObjectType.3 | 2 | ||||
| -rw-r--r-- | generic/tcl.h | 14 | ||||
| -rwxr-xr-x | generic/tclArithSeries.c | 4 | ||||
| -rw-r--r-- | generic/tclCmdIL.c | 14 | ||||
| -rw-r--r-- | generic/tclDictObj.c | 4 | ||||
| -rw-r--r-- | generic/tclExecute.c | 2 | ||||
| -rw-r--r-- | generic/tclTestObj.c | 2 | ||||
| -rw-r--r-- | generic/tclUtil.c | 4 |
9 files changed, 28 insertions, 26 deletions
diff --git a/doc/Object.3 b/doc/Object.3 index eb3620e..7be85e6 100644 --- a/doc/Object.3 +++ b/doc/Object.3 @@ -23,7 +23,7 @@ Tcl_Obj * .sp \fBTcl_DecrRefCount\fR(\fIobjPtr\fR) .sp -\fBTcl_BumpObj\fR(\fIobjPtr\fR) +\fBTcl_BounceRefCount\fR(\fIobjPtr\fR) .sp int \fBTcl_IsShared\fR(\fIobjPtr\fR) @@ -296,7 +296,7 @@ new reference to the value is created. The macro \fBTcl_DecrRefCount\fR decrements the count when a reference is no longer needed. If the value's reference count drops to zero, frees its storage. -The macro \fBTcl_BumpObj\fR will check if the value has no references (i.e. in a "new" state) and free the value. +The macro \fBTcl_BounceRefCount\fR will check if the value has no references (i.e. in a "new" state) and free the value. A value shared by different code or data structures has \fIrefCount\fR greater than 1. Incrementing a value's reference count ensures that it will not be freed too early or have its value change @@ -324,7 +324,7 @@ situation, it is the caller's responsibility to free the value before the procedure returns. One way to cover this is to always call \fBTcl_IncrRefCount\fR before using the value, then call \fBTcl_DecrRefCount\fR before returning. The other way is to use -\fBTcl_BumpObj\fR after the value is no longer needed or +\fBTcl_BounceRefCount\fR after the value is no longer needed or referenced. This macro will free the value if there are no other references to the value. When retaining a pointer to a value in a data structure the procedure must be careful to increment its reference @@ -368,7 +368,7 @@ If it is shared, it needs to duplicate the value in order to avoid accidentally changing values in other data structures. .PP In cases where a value is obtained, used, and not retained, the value -can be freed using \fBTcl_BumpObj\fR. This +can be freed using \fBTcl_BounceRefCount\fR. This is functionally equivalent to calling \fBTcl_IncrRefCount\fR followed \fBTcl_DecrRefCount\fR. .SH "SEE ALSO" diff --git a/doc/ObjectType.3 b/doc/ObjectType.3 index be1150a..3739c33 100644 --- a/doc/ObjectType.3 +++ b/doc/ObjectType.3 @@ -428,6 +428,6 @@ modify the reference count of their arguments, but if the values contain subsidiary values (e.g., the elements of a list or the keys of a dictionary) then those subsidiary values may have their reference counts modified. .SH "SEE ALSO" -Tcl_NewObj(3), Tcl_DecrRefCount(3), Tcl_IncrRefCount(3), Tcl_BumpObj(3) +Tcl_NewObj(3), Tcl_DecrRefCount(3), Tcl_IncrRefCount(3), Tcl_BounceRefCount(3) .SH KEYWORDS internal representation, value, value type, string representation, type conversion diff --git a/generic/tcl.h b/generic/tcl.h index e1dee64..3ef8957 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -674,7 +674,7 @@ typedef struct Tcl_ObjType { ** with the given valueObj. */ Tcl_ObjTypeReplaceProc *replaceProc; /* Replace subset with subset */ Tcl_ObjTypeInOperatorProc *inOperProc; /* "in" and "ni" expr list - ** operation Determine if the given + ** operation Determine if the given ** string value matches an element in ** the list */ #endif @@ -2482,10 +2482,10 @@ EXTERN const char *TclZipfs_AppHook(int *argc, char ***argv); * * This will free the obj if there are no references to the obj. */ -# define Tcl_BumpObj(objPtr) \ - TclBumpObj(objPtr, __FILE__, __LINE__) +# define Tcl_BounceRefCount(objPtr) \ + TclBounceRefCount(objPtr, __FILE__, __LINE__) -static inline void TclBumpObj(Tcl_Obj* objPtr, const char* fn, int line) +static inline void TclBounceRefCount(Tcl_Obj* objPtr, const char* fn, int line) { if (objPtr) { if ((objPtr)->refCount == 0) { @@ -2518,10 +2518,10 @@ static inline void TclBumpObj(Tcl_Obj* objPtr, const char* fn, int line) * This will release the obj if there is no referece count, * otherwise let it be. */ -# define Tcl_BumpObj(objPtr) \ - TclBumpObj(objPtr); +# define Tcl_BounceRefCount(objPtr) \ + TclBounceRefCount(objPtr); -static inline void TclBumpObj(Tcl_Obj* objPtr) +static inline void TclBounceRefCount(Tcl_Obj* objPtr) { if (objPtr) { if ((objPtr)->refCount == 0) { diff --git a/generic/tclArithSeries.c b/generic/tclArithSeries.c index 583b03e..2cfadb7 100755 --- a/generic/tclArithSeries.c +++ b/generic/tclArithSeries.c @@ -1160,7 +1160,7 @@ ArithSeriesInOperation( const char *estr = elemObj ? Tcl_GetStringFromObj(elemObj, &elen) : ""; /* "in" operation defined as a string compare */ test = (elen == vlen) ? (memcmp(estr, vstr, elen) == 0) : 0; - Tcl_BumpObj(elemObj); + Tcl_BounceRefCount(elemObj); /* Stop if we have a match */ if (test) { break; @@ -1190,7 +1190,7 @@ ArithSeriesInOperation( if (boolResult) { *boolResult = (elen == vlen) ? (memcmp(estr, vstr, elen) == 0) : 0; } - Tcl_BumpObj(elemObj); + Tcl_BounceRefCount(elemObj); } } return TCL_OK; diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 663d962..e90b793 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -3754,7 +3754,7 @@ Tcl_LsearchObjCmd( i = (lower + upper)/2; i -= i % groupSize; - Tcl_BumpObj(itemPtr); + Tcl_BounceRefCount(itemPtr); itemPtr = NULL; if (sortInfo.indexc != 0) { @@ -3855,7 +3855,7 @@ Tcl_LsearchObjCmd( } for (i = start; i < listc; i += groupSize) { match = 0; - Tcl_BumpObj(itemPtr); + Tcl_BounceRefCount(itemPtr); itemPtr = NULL; if (sortInfo.indexc != 0) { @@ -3957,7 +3957,7 @@ Tcl_LsearchObjCmd( */ if (returnSubindices && (sortInfo.indexc != 0)) { - Tcl_BumpObj(itemPtr); + Tcl_BounceRefCount(itemPtr); itemPtr = SelectObjFromSublist(listv[i+groupOffset], &sortInfo); Tcl_ListObjAppendElement(interp, listPtr, itemPtr); @@ -3965,7 +3965,7 @@ Tcl_LsearchObjCmd( Tcl_ListObjReplace(interp, listPtr, LIST_MAX, 0, groupSize, &listv[i]); } else { - Tcl_BumpObj(itemPtr); + Tcl_BounceRefCount(itemPtr); itemPtr = listv[i]; Tcl_ListObjAppendElement(interp, listPtr, itemPtr); } @@ -3986,7 +3986,7 @@ Tcl_LsearchObjCmd( } } - Tcl_BumpObj(itemPtr); + Tcl_BounceRefCount(itemPtr); itemPtr = NULL; /* @@ -4037,7 +4037,7 @@ Tcl_LsearchObjCmd( done: /* potential lingering abstract list element */ - Tcl_BumpObj(itemPtr); + Tcl_BounceRefCount(itemPtr); if (startPtr != NULL) { Tcl_DecrRefCount(startPtr); @@ -5582,7 +5582,7 @@ SelectObjFromSublist( return NULL; } objPtr = currentObj; - Tcl_BumpObj(lastObj); + Tcl_BounceRefCount(lastObj); lastObj = currentObj; } return objPtr; diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 94a30da..121661d 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -62,7 +62,7 @@ static Tcl_ObjCmdProc DictMapNRCmd; static Tcl_NRPostProc DictForLoopCallback; static Tcl_NRPostProc DictMapLoopCallback; static Tcl_ObjTypeLengthProc DictAsListLength; -static Tcl_ObjTypeIndexProc DictAsListIndex; +/* static Tcl_ObjTypeIndexProc DictAsListIndex; Needs rewrite */ /* * Table of dict subcommand names and implementations. @@ -3885,6 +3885,7 @@ DictAsListLength( * */ +#if 0 /* Needs rewrite */ static int DictAsListIndex( Tcl_Interp *interp, @@ -3952,6 +3953,7 @@ DictAsListIndex( *elemObjPtr = elemPtr; return TCL_OK; } +#endif /* * Local Variables: diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 5ece319..aa8930d 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5070,7 +5070,7 @@ TEBCresume( } /* Could be an ephemeral abstract obj */ - Tcl_BumpObj(o); + Tcl_BounceRefCount(o); i++; } while (i < length && match == 0); diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index 6a0d47d..682b41d 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -982,7 +982,7 @@ TestlistobjCmd( TCL_INDEX_NONE)); /* Keep looping since we are also looping for leaks */ } - Tcl_BumpObj(objP); + Tcl_BounceRefCount(objP); } break; diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 1fdcda3..79433e1 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2005,10 +2005,10 @@ Tcl_ConcatObj( != Tcl_ListObjAppendList(NULL, resPtr, objPtr)) { /* Abandon ship! */ Tcl_DecrRefCount(resPtr); - Tcl_BumpObj(elemPtr); // could be an abstract list element + Tcl_BounceRefCount(elemPtr); // could be an abstract list element goto slow; } - Tcl_BumpObj(elemPtr); // could be an an abstract list element + Tcl_BounceRefCount(elemPtr); // could be an an abstract list element } else { resPtr = TclDuplicatePureObj( NULL, objPtr, &tclListType); |
