File tree Expand file tree Collapse file tree 1 file changed +0
-27
lines changed Expand file tree Collapse file tree 1 file changed +0
-27
lines changed Original file line number Diff line number Diff line change @@ -4,33 +4,6 @@ use std::ffi::CStr;
4
4
use std:: os:: raw:: c_char;
5
5
use std:: sync:: Arc ;
6
6
7
- // pub unsafe fn ptr_to_ref<T>(ptr: *const T) -> &'static T {
8
- // ptr.as_ref().unwrap()
9
- // }
10
-
11
- // pub unsafe fn ptr_to_ref_mut<T>(ptr: *mut T) -> &'static mut T {
12
- // ptr.as_mut().unwrap()
13
- // }
14
-
15
- // pub unsafe fn free_boxed<T>(ptr: *mut T) {
16
- // if !ptr.is_null() {
17
- // // This takes the ownership of the boxed value and drops it
18
- // let _ = Box::from_raw(ptr);
19
- // }
20
- // }
21
-
22
- // pub unsafe fn clone_arced<T>(ptr: *const T) -> Arc<T> {
23
- // Arc::increment_strong_count(ptr);
24
- // Arc::from_raw(ptr)
25
- // }
26
-
27
- // pub unsafe fn free_arced<T>(ptr: *const T) {
28
- // if !ptr.is_null() {
29
- // // This decrements the arc's internal counter and potentially drops it
30
- // Arc::from_raw(ptr);
31
- // }
32
- // }
33
-
34
7
pub unsafe fn ptr_to_cstr ( ptr : * const c_char ) -> Option < & ' static str > {
35
8
CStr :: from_ptr ( ptr) . to_str ( ) . ok ( )
36
9
}
You can’t perform that action at this time.
0 commit comments