equal
deleted
inserted
replaced
34 /// for this type, and raises a Python `Exception` if the check does not pass. |
34 /// for this type, and raises a Python `Exception` if the check does not pass. |
35 /// Because this type differs only in name from the regular Python tuple, it |
35 /// Because this type differs only in name from the regular Python tuple, it |
36 /// would be a good idea in the near future to remove it entirely to allow |
36 /// would be a good idea in the near future to remove it entirely to allow |
37 /// for a pure Python tuple of the same effective structure to be used, |
37 /// for a pure Python tuple of the same effective structure to be used, |
38 /// rendering this type and the capsule below useless. |
38 /// rendering this type and the capsule below useless. |
39 type MakeDirstateTupleFn = extern "C" fn( |
39 type MakeDirstateTupleFn = unsafe extern "C" fn( |
40 state: c_char, |
40 state: c_char, |
41 mode: c_int, |
41 mode: c_int, |
42 size: c_int, |
42 size: c_int, |
43 mtime: c_int, |
43 mtime: c_int, |
44 ) -> PyObject; |
44 ) -> PyObject; |
73 } = entry; |
73 } = entry; |
74 // Explicitly go through u8 first, then cast to platform-specific `c_char` |
74 // Explicitly go through u8 first, then cast to platform-specific `c_char` |
75 // because Into<u8> has a specific implementation while `as c_char` would |
75 // because Into<u8> has a specific implementation while `as c_char` would |
76 // just do a naive enum cast. |
76 // just do a naive enum cast. |
77 let state_code: u8 = state.into(); |
77 let state_code: u8 = state.into(); |
78 Ok(make(state_code as c_char, mode, size, mtime)) |
78 |
|
79 unsafe { |
|
80 let ptr = make(state_code as c_char, mode, size, mtime); |
|
81 Ok(ptr) |
|
82 } |
79 } |
83 } |
80 |
84 |
81 pub fn extract_dirstate(py: Python, dmap: &PyDict) -> Result<StateMap, PyErr> { |
85 pub fn extract_dirstate(py: Python, dmap: &PyDict) -> Result<StateMap, PyErr> { |
82 dmap.items(py) |
86 dmap.items(py) |
83 .iter() |
87 .iter() |