MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / strings_to_string_list

Function strings_to_string_list

rust/src/string.rs:37–45  ·  view source on GitHub ↗

TODO: Make this pass in an iterator over something more generic...

(strings: &[String])

Source from the content-addressed store, hash-verified

35
36// TODO: Make this pass in an iterator over something more generic...
37pub(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)]

Callers 2

into_rawMethod · 0.85
into_rawMethod · 0.85

Calls 4

mapMethod · 0.80
as_strMethod · 0.80
iterMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected