@@ -8,12 +8,12 @@ use libc::{c_char, mode_t};
88use crate :: files:: map_file_at;
99pub ( crate ) use crate :: xwrap:: * ;
1010use crate :: {
11- CxxResultExt , Directory , FsPath , OsResultStatic , Utf8CStr , clone_attr, cstr, cstr_buf ,
12- fclone_attr , fd_path, map_fd, map_file, slice_from_ptr,
11+ CxxResultExt , Directory , FsPath , OsResultStatic , Utf8CStr , clone_attr, cstr, fclone_attr ,
12+ fd_path, map_fd, map_file, slice_from_ptr,
1313} ;
1414
1515pub ( crate ) fn fd_path_for_cxx ( fd : RawFd , buf : & mut [ u8 ] ) -> isize {
16- let mut buf = cstr_buf :: wrap ( buf) ;
16+ let mut buf = cstr :: buf :: wrap ( buf) ;
1717 fd_path ( fd, & mut buf)
1818 . log_cxx ( )
1919 . map_or ( -1_isize , |_| buf. len ( ) as isize )
@@ -23,11 +23,11 @@ pub(crate) fn fd_path_for_cxx(fd: RawFd, buf: &mut [u8]) -> isize {
2323unsafe extern "C" fn canonical_path ( path : * const c_char , buf : * mut u8 , bufsz : usize ) -> isize {
2424 unsafe {
2525 match Utf8CStr :: from_ptr ( path) {
26- Ok ( p ) => {
27- let mut buf = cstr_buf :: wrap_ptr ( buf, bufsz) ;
28- FsPath :: from ( p )
29- . realpath ( & mut buf )
30- . map_or ( -1 , |_| buf. len ( ) as isize )
26+ Ok ( path ) => {
27+ let mut buf = cstr :: buf :: wrap_ptr ( buf, bufsz) ;
28+ path . realpath ( & mut buf )
29+ . log_cxx ( )
30+ . map_or ( -1_isize , |_| buf. len ( ) as isize )
3131 }
3232 Err ( _) => -1 ,
3333 }
@@ -38,7 +38,7 @@ unsafe extern "C" fn canonical_path(path: *const c_char, buf: *mut u8, bufsz: us
3838unsafe extern "C" fn mkdirs_for_cxx ( path : * const c_char , mode : mode_t ) -> i32 {
3939 unsafe {
4040 match Utf8CStr :: from_ptr ( path) {
41- Ok ( p ) => FsPath :: from ( p ) . mkdirs ( mode) . map_or ( -1 , |_| 0 ) ,
41+ Ok ( path ) => path . mkdirs ( mode) . map_or ( -1 , |_| 0 ) ,
4242 Err ( _) => -1 ,
4343 }
4444 }
@@ -48,7 +48,7 @@ unsafe extern "C" fn mkdirs_for_cxx(path: *const c_char, mode: mode_t) -> i32 {
4848unsafe extern "C" fn rm_rf_for_cxx ( path : * const c_char ) -> bool {
4949 unsafe {
5050 match Utf8CStr :: from_ptr ( path) {
51- Ok ( p ) => FsPath :: from ( p ) . remove_all ( ) . is_ok ( ) ,
51+ Ok ( path ) => path . remove_all ( ) . is_ok ( ) ,
5252 Err ( _) => false ,
5353 }
5454 }
@@ -114,8 +114,6 @@ unsafe extern "C" fn cp_afc_for_cxx(src: *const c_char, dest: *const c_char) ->
114114 unsafe {
115115 if let Ok ( src) = Utf8CStr :: from_ptr ( src) {
116116 if let Ok ( dest) = Utf8CStr :: from_ptr ( dest) {
117- let src = FsPath :: from ( src) ;
118- let dest = FsPath :: from ( dest) ;
119117 return src. copy_to ( dest) . log_cxx ( ) . is_ok ( ) ;
120118 }
121119 }
@@ -128,8 +126,6 @@ unsafe extern "C" fn mv_path_for_cxx(src: *const c_char, dest: *const c_char) ->
128126 unsafe {
129127 if let Ok ( src) = Utf8CStr :: from_ptr ( src) {
130128 if let Ok ( dest) = Utf8CStr :: from_ptr ( dest) {
131- let src = FsPath :: from ( src) ;
132- let dest = FsPath :: from ( dest) ;
133129 return src. move_to ( dest) . log_cxx ( ) . is_ok ( ) ;
134130 }
135131 }
@@ -142,8 +138,6 @@ unsafe extern "C" fn link_path_for_cxx(src: *const c_char, dest: *const c_char)
142138 unsafe {
143139 if let Ok ( src) = Utf8CStr :: from_ptr ( src) {
144140 if let Ok ( dest) = Utf8CStr :: from_ptr ( dest) {
145- let src = FsPath :: from ( src) ;
146- let dest = FsPath :: from ( dest) ;
147141 return src. link_to ( dest) . log_cxx ( ) . is_ok ( ) ;
148142 }
149143 }
@@ -156,8 +150,6 @@ unsafe extern "C" fn clone_attr_for_cxx(src: *const c_char, dest: *const c_char)
156150 unsafe {
157151 if let Ok ( src) = Utf8CStr :: from_ptr ( src) {
158152 if let Ok ( dest) = Utf8CStr :: from_ptr ( dest) {
159- let src = FsPath :: from ( src) ;
160- let dest = FsPath :: from ( dest) ;
161153 return clone_attr ( src, dest) . log_cxx ( ) . is_ok ( ) ;
162154 }
163155 }
0 commit comments