(s: &str, u: *const u8)
| 66 | } |
| 67 | |
| 68 | fn compare_str_u8(s: &str, u: *const u8) -> bool { |
| 69 | unsafe { |
| 70 | let len = (0..).take_while(|&i| *u.offset(i) != 0).count(); |
| 71 | let slice = core::slice::from_raw_parts(u, len); |
| 72 | let s_len = s.len(); |
| 73 | if len != s_len { |
| 74 | return false; |
| 75 | } |
| 76 | let ss = s.as_bytes(); |
| 77 | for i in 0..len { |
| 78 | if slice[i] != ss[i] as u8 { |
| 79 | return false; |
| 80 | } |
| 81 | } |
| 82 | return true; |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | fn str_to_i8(s: &str) -> *const i8 { |
| 87 | s.as_bytes().as_ptr() as *const i8 |
nothing calls this directly
no outgoing calls
no test coverage detected