MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / c_string_array

Function c_string_array

crates/openshell-driver-vm/src/runtime.rs:1372–1381  ·  view source on GitHub ↗
(strings: &[&str])

Source from the content-addressed store, hash-verified

1370}
1371
1372fn c_string_array(strings: &[&str]) -> Result<(Vec<CString>, Vec<*const libc::c_char>), String> {
1373 let owned: Vec<CString> = strings
1374 .iter()
1375 .map(|s| CString::new(*s))
1376 .collect::<Result<Vec<_>, _>>()
1377 .map_err(|e| format!("invalid string array entry: {e}"))?;
1378 let mut ptrs: Vec<*const libc::c_char> = owned.iter().map(|c| c.as_ptr()).collect();
1379 ptrs.push(ptr::null());
1380 Ok((owned, ptrs))
1381}
1382
1383fn path_to_cstring(path: &Path) -> Result<CString, String> {
1384 let path = path

Callers 1

set_execMethod · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected