File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1- pub fn Tcl_DecrRefCount ( objPtr : * mut Tcl_Obj ) {
1+ /// Decrement the reference count of a Tcl object.
2+ /// If the reference count reaches zero, the object is freed.
3+ ///
4+ /// # Safety
5+ /// If the reference count is decremented to zero, the object is freed and `objPtr` turns into a null pointer.
6+ pub unsafe fn Tcl_DecrRefCount ( objPtr : * mut Tcl_Obj ) {
27 let mut obj = unsafe { * objPtr } ;
38 obj. refCount -= 1 ;
49 if obj. refCount == 0 {
@@ -7,7 +12,12 @@ pub fn Tcl_DecrRefCount(objPtr: *mut Tcl_Obj) {
712 }
813}
914
10- pub fn Tcl_IncrRefCount ( objPtr : * mut Tcl_Obj ) {
15+ /// Increment the reference count of a Tcl object.
16+ /// This is used to indicate that the object is being used and should not be freed.
17+ ///
18+ /// # Safety
19+ /// If [`Tcl_DecrRefCount`] is not called and the pointer is dropped, the object will be leaked.
20+ pub unsafe fn Tcl_IncrRefCount ( objPtr : * mut Tcl_Obj ) {
1121 let mut obj = unsafe { * objPtr } ;
1222 obj. refCount += 1 ;
1323}
You can’t perform that action at this time.
0 commit comments