(packed_ip: ArgBytesLike, vm: &VirtualMachine)
| 2659 | |
| 2660 | #[pyfunction] |
| 2661 | fn inet_ntoa(packed_ip: ArgBytesLike, vm: &VirtualMachine) -> PyResult<PyStrRef> { |
| 2662 | let packed_ip = packed_ip.borrow_buf(); |
| 2663 | let packed_ip = <&[u8; 4]>::try_from(&*packed_ip) |
| 2664 | .map_err(|_| vm.new_os_error("packed IP wrong length for inet_ntoa".to_owned()))?; |
| 2665 | Ok(vm.ctx.new_str(Ipv4Addr::from(*packed_ip).to_string())) |
| 2666 | } |
| 2667 | |
| 2668 | fn cstr_opt_as_ptr(x: &OptionalArg<ffi::CString>) -> *const libc::c_char { |
| 2669 | x.as_ref().map_or_else(core::ptr::null, |s| s.as_ptr()) |
nothing calls this directly
no test coverage detected