25
25
#[ cfg( any( test, feature = "std" ) ) ]
26
26
extern crate core;
27
27
28
+ #[ cfg( feature = "alloc" ) ]
29
+ extern crate alloc;
30
+
28
31
#[ cfg( fuzzing) ]
29
32
const THIS_UNUSED_CONSTANT_IS_YOUR_WARNING_THAT_ALL_THE_CRYPTO_IN_THIS_LIB_IS_DISABLED_FOR_FUZZING : usize = 0 ;
30
33
@@ -540,11 +543,11 @@ extern "C" {
540
543
///
541
544
/// The newly created secp256k1 raw context.
542
545
#[ no_mangle]
543
- #[ cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ]
544
- #[ cfg_attr( docsrs, doc( cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
546
+ #[ cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ]
547
+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
545
548
pub unsafe extern "C" fn rustsecp256k1_v0_5_0_context_create ( flags : c_uint ) -> * mut Context {
546
549
use core:: mem;
547
- use std :: alloc;
550
+ use crate :: alloc :: alloc;
548
551
assert ! ( ALIGN_TO >= mem:: align_of:: <usize >( ) ) ;
549
552
assert ! ( ALIGN_TO >= mem:: align_of:: <& usize >( ) ) ;
550
553
assert ! ( ALIGN_TO >= mem:: size_of:: <usize >( ) ) ;
@@ -560,8 +563,8 @@ pub unsafe extern "C" fn rustsecp256k1_v0_5_0_context_create(flags: c_uint) -> *
560
563
secp256k1_context_preallocated_create ( ptr, flags)
561
564
}
562
565
563
- #[ cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ]
564
- #[ cfg_attr( docsrs, doc( cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
566
+ #[ cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ]
567
+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
565
568
pub unsafe fn secp256k1_context_create ( flags : c_uint ) -> * mut Context {
566
569
rustsecp256k1_v0_5_0_context_create ( flags)
567
570
}
@@ -573,19 +576,19 @@ pub unsafe fn secp256k1_context_create(flags: c_uint) -> *mut Context {
573
576
/// The pointer shouldn't be used after passing to this function, consider it as passing it to `free()`.
574
577
///
575
578
#[ no_mangle]
576
- #[ cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ]
577
- #[ cfg_attr( docsrs, doc( cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
579
+ #[ cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ]
580
+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
578
581
pub unsafe extern "C" fn rustsecp256k1_v0_5_0_context_destroy ( ctx : * mut Context ) {
579
- use std :: alloc;
582
+ use crate :: alloc :: alloc;
580
583
secp256k1_context_preallocated_destroy ( ctx) ;
581
584
let ptr = ( ctx as * mut u8 ) . sub ( ALIGN_TO ) ;
582
585
let bytes = ( ptr as * mut usize ) . read ( ) ;
583
586
let layout = alloc:: Layout :: from_size_align ( bytes, ALIGN_TO ) . unwrap ( ) ;
584
587
alloc:: dealloc ( ptr, layout) ;
585
588
}
586
589
587
- #[ cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ]
588
- #[ cfg_attr( docsrs, doc( cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
590
+ #[ cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ]
591
+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
589
592
pub unsafe fn secp256k1_context_destroy ( ctx : * mut Context ) {
590
593
rustsecp256k1_v0_5_0_context_destroy ( ctx)
591
594
}
0 commit comments