Skip to content

Commit 7ca45fd

Browse files
committed
fix compilation of RefCount functions
1 parent c08cb2a commit 7ca45fd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

custom.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
///
44
/// # Safety
55
/// If the reference count is decremented to zero, the object is freed and `objPtr` turns into a null pointer.
6+
/// If objPtr is null, UB occurs.
67
pub unsafe fn Tcl_DecrRefCount(objPtr: *mut Tcl_Obj) {
78
let mut obj = unsafe { *objPtr };
89
obj.refCount -= 1;
910
if obj.refCount == 0 {
1011
// Free the object
11-
unsafe { Tcl_Free(objPtr as *mut std::ffi::c_char) };
12+
unsafe { Tcl_Free(objPtr as _) };
1213
}
1314
}
1415

@@ -17,6 +18,7 @@ pub unsafe fn Tcl_DecrRefCount(objPtr: *mut Tcl_Obj) {
1718
///
1819
/// # Safety
1920
/// If [`Tcl_DecrRefCount`] is not called and the pointer is dropped, the object will be leaked.
21+
/// If objPtr is null, UB occurs.
2022
pub unsafe fn Tcl_IncrRefCount(objPtr: *mut Tcl_Obj) {
2123
let mut obj = unsafe { *objPtr };
2224
obj.refCount += 1;

0 commit comments

Comments
 (0)