File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,6 @@ use libz_rs_sys::gzopen;
55use std:: ffi:: CString ;
66use std:: ptr;
77
8- // Turn a Rust string into a C string
9- macro_rules! cs {
10- ( $str: expr) => {
11- CString :: new( $str) . unwrap( ) . as_ptr( )
12- } ;
13- }
14-
158// Generate a file path relative to the project's root
169macro_rules! path {
1710 ( $str: expr) => {
@@ -20,7 +13,9 @@ macro_rules! path {
2013}
2114
2215unsafe fn test_open ( path : & str , mode : & str , should_succeed : bool ) {
23- let handle = gzopen ( cs ! ( path) , cs ! ( mode) ) ;
16+ let cpath = CString :: new ( path) . unwrap ( ) ;
17+ let cmode = CString :: new ( mode) . unwrap ( ) ;
18+ let handle = gzopen ( cpath. as_ptr ( ) , cmode. as_ptr ( ) ) ;
2419 assert_eq ! ( should_succeed, !handle. is_null( ) , "{path} {mode}" ) ;
2520 if !handle. is_null ( ) {
2621 assert_eq ! ( gzclose( handle) , Z_OK ) ;
You can’t perform that action at this time.
0 commit comments