(name: PyStrRef, vm: &VirtualMachine)
| 3000 | |
| 3001 | #[pyfunction] |
| 3002 | fn getprotobyname(name: PyStrRef, vm: &VirtualMachine) -> PyResult { |
| 3003 | let cstr = name.to_cstring(vm)?; |
| 3004 | let proto = unsafe { c::getprotobyname(cstr.as_ptr() as _) }; |
| 3005 | if proto.is_null() { |
| 3006 | return Err(vm.new_os_error("protocol not found".to_owned())); |
| 3007 | } |
| 3008 | let num = unsafe { (*proto).p_proto }; |
| 3009 | Ok(vm.ctx.new_int(num).into()) |
| 3010 | } |
| 3011 | |
| 3012 | #[pyfunction] |
| 3013 | fn getnameinfo( |
nothing calls this directly
no test coverage detected