@@ -67,10 +67,6 @@ mod contents {
67
67
target_os = "dragonfly" , target_os = "windows" , target_env = "musl" ) ,
68
68
link_name = "je_nallocx" ) ]
69
69
fn nallocx ( size : size_t , flags : c_int ) -> size_t ;
70
- #[ cfg_attr( any( target_os = "macos" , target_os = "android" , target_os = "ios" ,
71
- target_os = "dragonfly" , target_os = "windows" , target_env = "musl" ) ,
72
- link_name = "je_sallocx" ) ]
73
- fn sallocx ( ptr : * mut c_void , flags : c_int ) -> size_t ;
74
70
}
75
71
76
72
const MALLOCX_ZERO : c_int = 0x40 ;
@@ -215,29 +211,18 @@ mod contents {
215
211
#[ no_mangle]
216
212
#[ linkage = "external" ]
217
213
pub unsafe extern fn __rde_realloc_excess ( ptr : * mut u8 ,
218
- _old_size : usize ,
214
+ old_size : usize ,
219
215
old_align : usize ,
220
216
new_size : usize ,
221
217
new_align : usize ,
222
218
excess : * mut usize ,
223
219
err : * mut u8 ) -> * mut u8 {
224
- if new_align != old_align {
225
- ptr:: write ( err as * mut AllocErr ,
226
- AllocErr :: Unsupported { details : "can't change alignments" } ) ;
227
- return 0 as * mut u8
228
- }
229
-
230
- let flags = align_to_flags ( new_align) ;
231
- let ptr = rallocx ( ptr as * mut c_void , new_size, flags) as * mut u8 ;
232
- if ptr. is_null ( ) {
233
- let layout = Layout :: from_size_align_unchecked ( new_size, new_align) ;
234
- ptr:: write ( err as * mut AllocErr ,
235
- AllocErr :: Exhausted { request : layout } ) ;
236
- } else {
237
- let alloc_size = sallocx ( ptr as * mut c_void , flags) ;
238
- * excess = alloc_size;
220
+ let p = __rde_realloc ( ptr, old_size, old_align, new_size, new_align, err) ;
221
+ if !p. is_null ( ) {
222
+ let flags = align_to_flags ( new_align) ;
223
+ * excess = nallocx ( new_size, flags) as usize ;
239
224
}
240
- ptr
225
+ p
241
226
}
242
227
243
228
#[ no_mangle]
0 commit comments