mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 13:53:10 +00:00
10ee87eb28
owning_null_terminated_array is used for environment variables, where we need to provide envp for child processes. This switches the implementation from C++ to Rust. We retain the C++ owning_null_terminated_array_t; it simply wraps the Rust version now.
19 lines
674 B
C++
19 lines
674 B
C++
#include "null_terminated_array.h"
|
|
|
|
std::vector<std::string> wide_string_list_to_narrow(const std::vector<wcstring> &strs) {
|
|
std::vector<std::string> res;
|
|
res.reserve(strs.size());
|
|
for (const wcstring &s : strs) {
|
|
res.push_back(wcs2zstring(s));
|
|
}
|
|
return res;
|
|
}
|
|
|
|
const char **owning_null_terminated_array_t::get() { return impl_->get(); }
|
|
|
|
owning_null_terminated_array_t::owning_null_terminated_array_t(std::vector<std::string> &&strings)
|
|
: impl_(new_owning_null_terminated_array(strings)) {}
|
|
|
|
owning_null_terminated_array_t::owning_null_terminated_array_t(
|
|
rust::Box<OwningNullTerminatedArrayRefFFI> impl)
|
|
: impl_(std::move(impl)) {}
|