@@ -7,25 +7,25 @@ use std::io::{Read, Seek, Write};
77use std:: os:: fd:: { AsFd , FromRawFd , IntoRawFd } ;
88use std:: rc:: Rc ;
99pub unsafe fn test_errno_0 ( ) {
10- ( * libc :: __errno_location ( ) ) = 0 ;
11- assert ! ( ( ( ( ( * libc :: __errno_location ( ) ) == ( 0 ) ) as i32 ) != 0 ) ) ;
12- ( * libc :: __errno_location ( ) ) = 42 ;
13- assert ! ( ( ( ( ( * libc :: __errno_location ( ) ) == ( 42 ) ) as i32 ) != 0 ) ) ;
14- let mut saved: i32 = ( * libc :: __errno_location ( ) ) ;
10+ ( * libcc2rs :: cpp2rust_errno ( ) ) = 0 ;
11+ assert ! ( ( ( ( ( * libcc2rs :: cpp2rust_errno ( ) ) == ( 0 ) ) as i32 ) != 0 ) ) ;
12+ ( * libcc2rs :: cpp2rust_errno ( ) ) = 42 ;
13+ assert ! ( ( ( ( ( * libcc2rs :: cpp2rust_errno ( ) ) == ( 42 ) ) as i32 ) != 0 ) ) ;
14+ let mut saved: i32 = ( * libcc2rs :: cpp2rust_errno ( ) ) ;
1515 assert ! ( ( ( ( ( saved) == ( 42 ) ) as i32 ) != 0 ) ) ;
16- ( * libc :: __errno_location ( ) ) = 0 ;
16+ ( * libcc2rs :: cpp2rust_errno ( ) ) = 0 ;
1717}
1818pub unsafe fn test_errno_preserved_across_strdup_1 ( ) {
19- ( * libc :: __errno_location ( ) ) = 99 ;
19+ ( * libcc2rs :: cpp2rust_errno ( ) ) = 99 ;
2020 let mut d: * mut u8 =
2121 libc:: strdup ( ( b"hello\0 " . as_ptr ( ) . cast_mut ( ) ) . cast_const ( ) as * const i8 ) as * mut u8 ;
2222 assert ! ( ( ( ( !( ( d) . is_null( ) ) ) as i32 ) != 0 ) ) ;
23- assert ! ( ( ( ( ( * libc :: __errno_location ( ) ) == ( 99 ) ) as i32 ) != 0 ) ) ;
23+ assert ! ( ( ( ( ( * libcc2rs :: cpp2rust_errno ( ) ) == ( 99 ) ) as i32 ) != 0 ) ) ;
2424 libc:: free ( ( d as * mut u8 as * mut :: libc:: c_void ) ) ;
25- ( * libc :: __errno_location ( ) ) = 0 ;
25+ ( * libcc2rs :: cpp2rust_errno ( ) ) = 0 ;
2626}
2727pub unsafe fn test_errno_from_fseek_2 ( ) {
28- ( * libc :: __errno_location ( ) ) = 0 ;
28+ ( * libcc2rs :: cpp2rust_errno ( ) ) = 0 ;
2929 let mut r: i32 = if ( match 0 {
3030 0 => ( * libcc2rs:: cin_unsafe ( ) ) . seek ( std:: io:: SeekFrom :: Start ( 0_i64 as u64 ) ) ,
3131 1 => ( * libcc2rs:: cin_unsafe ( ) ) . seek ( std:: io:: SeekFrom :: Current ( 0_i64 ) ) ,
@@ -39,8 +39,8 @@ pub unsafe fn test_errno_from_fseek_2() {
3939 -1
4040 } ;
4141 assert ! ( ( ( ( ( r) == ( -1_i32 ) ) as i32 ) != 0 ) ) ;
42- assert ! ( ( ( ( ( * libc :: __errno_location ( ) ) == ( 29 ) ) as i32 ) != 0 ) ) ;
43- ( * libc :: __errno_location ( ) ) = 0 ;
42+ assert ! ( ( ( ( ( * libcc2rs :: cpp2rust_errno ( ) ) == ( 29 ) ) as i32 ) != 0 ) ) ;
43+ ( * libcc2rs :: cpp2rust_errno ( ) ) = 0 ;
4444}
4545pub fn main ( ) {
4646 unsafe {
0 commit comments