@@ -27,7 +27,7 @@ use crate::{
27
27
platform:: Platform ,
28
28
rc:: * ,
29
29
relocation:: CoreRelocationHandler ,
30
- string:: BnStrCompatible ,
30
+ string:: AsCStr ,
31
31
string:: * ,
32
32
types:: { NameAndType , Type } ,
33
33
Endianness ,
@@ -1404,8 +1404,7 @@ impl CoreArchitecture {
1404
1404
}
1405
1405
1406
1406
pub fn by_name ( name : & str ) -> Option < Self > {
1407
- let handle =
1408
- unsafe { BNGetArchitectureByName ( name. into_bytes_with_nul ( ) . as_ptr ( ) as * mut _ ) } ;
1407
+ let handle = unsafe { BNGetArchitectureByName ( name. to_cstr ( ) . as_ptr ( ) as * mut _ ) } ;
1409
1408
match handle. is_null ( ) {
1410
1409
false => Some ( CoreArchitecture { handle } ) ,
1411
1410
true => None ,
@@ -1953,8 +1952,8 @@ macro_rules! cc_func {
1953
1952
1954
1953
/// Contains helper methods for all types implementing 'Architecture'
1955
1954
pub trait ArchitectureExt : Architecture {
1956
- fn register_by_name < S : BnStrCompatible > ( & self , name : S ) -> Option < Self :: Register > {
1957
- let name = name. into_bytes_with_nul ( ) ;
1955
+ fn register_by_name < S : AsCStr > ( & self , name : S ) -> Option < Self :: Register > {
1956
+ let name = name. to_cstr ( ) ;
1958
1957
1959
1958
match unsafe {
1960
1959
BNGetArchitectureRegisterByName ( self . as_ref ( ) . handle , name. as_ref ( ) . as_ptr ( ) as * mut _ )
@@ -2033,7 +2032,7 @@ pub trait ArchitectureExt: Architecture {
2033
2032
2034
2033
fn register_relocation_handler < S , R , F > ( & self , name : S , func : F )
2035
2034
where
2036
- S : BnStrCompatible ,
2035
+ S : AsCStr ,
2037
2036
R : ' static
2038
2037
+ RelocationHandler < Handle = CustomRelocationHandlerHandle < R > >
2039
2038
+ Send
@@ -2056,7 +2055,7 @@ impl<T: Architecture> ArchitectureExt for T {}
2056
2055
2057
2056
pub fn register_architecture < S , A , F > ( name : S , func : F ) -> & ' static A
2058
2057
where
2059
- S : BnStrCompatible ,
2058
+ S : AsCStr ,
2060
2059
A : ' static + Architecture < Handle = CustomArchitectureHandle < A > > + Send + Sync + Sized ,
2061
2060
F : FnOnce ( CustomArchitectureHandle < A > , CoreArchitecture ) -> A ,
2062
2061
{
@@ -3130,7 +3129,7 @@ where
3130
3129
custom_arch. skip_and_return_value ( data, addr, val)
3131
3130
}
3132
3131
3133
- let name = name. into_bytes_with_nul ( ) ;
3132
+ let name = name. to_cstr ( ) ;
3134
3133
3135
3134
let uninit_arch = ArchitectureBuilder {
3136
3135
arch : MaybeUninit :: zeroed ( ) ,
0 commit comments