File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -78,18 +78,16 @@ impl Heap {
7878 assert ! ( !heap. initialized) ;
7979 let block: NonNull < [ u8 ] > =
8080 NonNull :: slice_from_raw_parts ( NonNull :: new_unchecked ( start_addr as * mut u8 ) , size) ;
81- if let Some ( actual_size) = heap. tlsf . insert_free_block_ptr ( block) {
82- let block: NonNull < [ u8 ] > = NonNull :: slice_from_raw_parts (
83- NonNull :: new_unchecked ( start_addr as * mut u8 ) ,
84- actual_size. get ( ) ,
85- ) ;
86- heap. initialized = true ;
87- heap. raw_block = Some ( block) ;
88- heap. raw_block_size = size;
89- }
90- if !heap. initialized {
81+ let Some ( actual_size) = heap. tlsf . insert_free_block_ptr ( block) else {
9182 panic ! ( "Allocation too small for heap" ) ;
92- }
83+ } ;
84+ let block: NonNull < [ u8 ] > = NonNull :: slice_from_raw_parts (
85+ NonNull :: new_unchecked ( start_addr as * mut u8 ) ,
86+ actual_size. get ( ) ,
87+ ) ;
88+ heap. initialized = true ;
89+ heap. raw_block = Some ( block) ;
90+ heap. raw_block_size = size;
9391 } ) ;
9492 }
9593
You can’t perform that action at this time.
0 commit comments