@@ -27,7 +27,7 @@ use crate::{
2727 platform:: Platform ,
2828 rc:: * ,
2929 relocation:: CoreRelocationHandler ,
30- string:: BnStrCompatible ,
30+ string:: AsCStr ,
3131 string:: * ,
3232 types:: { NameAndType , Type } ,
3333 Endianness ,
@@ -1404,8 +1404,7 @@ impl CoreArchitecture {
14041404 }
14051405
14061406 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 _ ) } ;
14091408 match handle. is_null ( ) {
14101409 false => Some ( CoreArchitecture { handle } ) ,
14111410 true => None ,
@@ -1953,8 +1952,8 @@ macro_rules! cc_func {
19531952
19541953/// Contains helper methods for all types implementing 'Architecture'
19551954pub 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 ( ) ;
19581957
19591958 match unsafe {
19601959 BNGetArchitectureRegisterByName ( self . as_ref ( ) . handle , name. as_ref ( ) . as_ptr ( ) as * mut _ )
@@ -2033,7 +2032,7 @@ pub trait ArchitectureExt: Architecture {
20332032
20342033 fn register_relocation_handler < S , R , F > ( & self , name : S , func : F )
20352034 where
2036- S : BnStrCompatible ,
2035+ S : AsCStr ,
20372036 R : ' static
20382037 + RelocationHandler < Handle = CustomRelocationHandlerHandle < R > >
20392038 + Send
@@ -2056,7 +2055,7 @@ impl<T: Architecture> ArchitectureExt for T {}
20562055
20572056pub fn register_architecture < S , A , F > ( name : S , func : F ) -> & ' static A
20582057where
2059- S : BnStrCompatible ,
2058+ S : AsCStr ,
20602059 A : ' static + Architecture < Handle = CustomArchitectureHandle < A > > + Send + Sync + Sized ,
20612060 F : FnOnce ( CustomArchitectureHandle < A > , CoreArchitecture ) -> A ,
20622061{
@@ -3130,7 +3129,7 @@ where
31303129 custom_arch. skip_and_return_value ( data, addr, val)
31313130 }
31323131
3133- let name = name. into_bytes_with_nul ( ) ;
3132+ let name = name. to_cstr ( ) ;
31343133
31353134 let uninit_arch = ArchitectureBuilder {
31363135 arch : MaybeUninit :: zeroed ( ) ,
0 commit comments