MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / createNullTerminatedString

Function createNullTerminatedString

lib/host/wasi/inode-win.cpp:56–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54static_assert(sizeof(UniversalAddress) == 128);
55
56std::pair<const char *, std::unique_ptr<char[]>>
57createNullTerminatedString(std::string_view View) noexcept {
58 const char *CStr = nullptr;
59 std::unique_ptr<char[]> Buffer;
60 if (!View.empty()) {
61 if (const auto Pos = View.find_first_of('\0');
62 Pos != std::string_view::npos) {
63 CStr = View.data();
64 } else {
65 Buffer = std::make_unique<char[]>(View.size() + 1);
66 std::copy(View.begin(), View.end(), Buffer.get());
67 CStr = Buffer.get();
68 }
69 }
70 return {CStr, std::move(Buffer)};
71}
72
73WasiExpect<std::tuple<DWORD_, DWORD_, DWORD_>> inline constexpr getOpenFlags(
74 __wasi_oflags_t OpenFlags, __wasi_fdflags_t FdFlags,

Callers 1

getAddrinfoMethod · 0.70

Calls 6

emptyMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected