TODO: Make this pass in an iterator over something more generic...
(strings: &[String])
| 35 | |
| 36 | // TODO: Make this pass in an iterator over something more generic... |
| 37 | pub(crate) fn strings_to_string_list(strings: &[String]) -> *mut *mut c_char { |
| 38 | use binaryninjacore_sys::BNAllocStringList; |
| 39 | let bn_str_list = strings |
| 40 | .iter() |
| 41 | .map(|s| BnString::new(s.as_str())) |
| 42 | .collect::<Vec<_>>(); |
| 43 | let mut raw_str_list = bn_str_list.iter().map(|s| s.as_ptr()).collect::<Vec<_>>(); |
| 44 | unsafe { BNAllocStringList(raw_str_list.as_mut_ptr(), raw_str_list.len()) } |
| 45 | } |
| 46 | |
| 47 | /// Is the equivalent of `core::ffi::CString` but using the alloc and free from `binaryninjacore-sys`. |
| 48 | #[repr(transparent)] |