File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,11 +25,6 @@ const size_t rustsimplicity_0_5_c_alignof_rawElementsTransaction = alignof(rawEl
2525const size_t rustsimplicity_0_5_c_alignof_rawElementsTapEnv = alignof(rawElementsTapEnv );
2626const size_t rustsimplicity_0_5_c_alignof_txEnv = alignof(txEnv );
2727
28- void rustsimplicity_0_5_c_set_rawElementsBuffer (rawElementsBuffer * result , const unsigned char * buf , unsigned int len )
29- {
30- * result = (rawElementsBuffer ){.buf = buf , .len = len };
31- }
32-
3328void rustsimplicity_0_5_c_set_rawElementsTransaction (rawElementsTransaction * result , unsigned int version ,
3429 const unsigned char * txid ,
3530 const rawElementsInput * input , unsigned int numInputs ,
Original file line number Diff line number Diff line change @@ -173,9 +173,6 @@ extern "C" {
173173 #[ link_name = "rustsimplicity_0_5_c_alignof_txEnv" ]
174174 pub static c_alignof_txEnv: c_size_t ;
175175
176- #[ link_name = "rustsimplicity_0_5_c_set_rawElementsBuffer" ]
177- pub fn c_set_rawBuffer ( res : * mut CRawBuffer , buf : * const c_uchar , len : c_uint ) ;
178-
179176 #[ link_name = "rustsimplicity_0_5_c_set_rawElementsTransaction" ]
180177 pub fn c_set_rawTransaction (
181178 result : * mut CRawTransaction ,
@@ -226,10 +223,9 @@ impl Drop for CTxEnv {
226223
227224impl CRawBuffer {
228225 pub fn new ( buf : & [ c_uchar ] ) -> Self {
229- unsafe {
230- let mut raw_buffer = std:: mem:: MaybeUninit :: < Self > :: uninit ( ) ;
231- c_set_rawBuffer ( raw_buffer. as_mut_ptr ( ) , buf. as_ptr ( ) , buf. len ( ) as c_uint ) ;
232- raw_buffer. assume_init ( )
226+ Self {
227+ ptr : buf. as_ptr ( ) ,
228+ len : buf. len ( ) . try_into ( ) . expect ( "sane buffer lengths" ) ,
233229 }
234230 }
235231}
You can’t perform that action at this time.
0 commit comments