File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,12 @@ use std::io::prelude::*;
66use std:: io:: { Read , Seek , Write } ;
77use std:: os:: fd:: AsFd ;
88use std:: rc:: { Rc , Weak } ;
9+ pub fn take_0 ( p : Ptr < Ptr < i8 > > ) -> i8 {
10+ elem ! ( ( p. read( ) ) , 0 ) . write ( 9_i8 ) ;
11+ let mut c: i8 = ( elem ! ( ( p. read( ) ) , 0 ) . read ( ) ) ;
12+ ( p. read ( ) ) . delete ( ) ;
13+ return c;
14+ }
915pub fn main ( ) {
1016 __cpp2rust_init_globals ( ) ;
1117 std:: process:: exit ( main_0 ( ) ) ;
@@ -15,6 +21,13 @@ fn main_0() -> i32 {
1521 elem ! ( e, 0 ) . write ( 6 ) ;
1622 elem ! ( e, 1 ) . write ( 7 ) ;
1723 e. delete ( ) ;
24+ let mut c: i8 = ( {
25+ let _p: Value < Ptr < i8 > > = Rc :: new ( RefCell :: new ( Ptr :: alloc_array (
26+ ( 0 ..4_usize ) . map ( |_| 0_i8 ) . collect :: < Box < [ i8 ] > > ( ) ,
27+ ) ) ) ;
28+ take_0 ( _p. as_pointer ( ) )
29+ } ) ;
30+ & ( c) ;
1831 return 0 ;
1932}
2033pub fn __cpp2rust_init_globals ( ) { }
Original file line number Diff line number Diff line change @@ -6,6 +6,21 @@ use std::collections::BTreeMap;
66use std:: io:: { Read , Seek , Write } ;
77use std:: os:: fd:: { AsFd , FromRawFd , IntoRawFd } ;
88use std:: rc:: Rc ;
9+ pub unsafe fn take_0 ( p : * mut * mut libc:: c_char ) -> libc:: c_char {
10+ ( * ( * p) . offset ( ( 0 ) as isize ) ) = ( 9 as libc:: c_char ) ;
11+ let mut c: libc:: c_char = ( * ( * p) . offset ( ( 0 ) as isize ) ) ;
12+ {
13+ let __p = ( * p) ;
14+ if !__p. is_null ( ) {
15+ :: std:: mem:: drop ( Box :: from_raw ( :: std:: slice:: from_raw_parts_mut (
16+ __p,
17+ libcc2rs:: malloc_usable_size ( __p as * mut :: libc:: c_void )
18+ / :: std:: mem:: size_of :: < libc:: c_char > ( ) ,
19+ ) ) )
20+ }
21+ } ;
22+ return c;
23+ }
924pub fn main ( ) {
1025 unsafe {
1126 __cpp2rust_init_globals ( ) ;
@@ -27,6 +42,16 @@ unsafe fn main_0() -> i32 {
2742 ) ) )
2843 }
2944 } ;
45+ let mut c: libc:: c_char = ( unsafe {
46+ let mut _p: * mut libc:: c_char = Box :: leak (
47+ ( 0 ..4_usize )
48+ . map ( |_| ( 0 as libc:: c_char ) )
49+ . collect :: < Box < [ libc:: c_char ] > > ( ) ,
50+ )
51+ . as_mut_ptr ( ) ;
52+ take_0 ( & mut _p)
53+ } ) ;
54+ & ( c) ;
3055 return 0 ;
3156}
3257pub unsafe fn __cpp2rust_init_globals ( ) { }
You can’t perform that action at this time.
0 commit comments