MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / WasmEdge_String WasmEdge_StringCreateByBuffer

Function WasmEdge_String WasmEdge_StringCreateByBuffer

lib/api/wasmedge.cpp:778–790  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

776}
777
778WASMEDGE_CAPI_EXPORT WasmEdge_String
779WasmEdge_StringCreateByBuffer(const char *Buf, const uint32_t Len) noexcept {
780 try {
781 if (Buf && Len) {
782 char *Str = new char[Len];
783 std::copy_n(Buf, Len, Str);
784 return WasmEdge_String{/* Length */ Len, /* Buf */ Str};
785 }
786 } catch (...) {
787 handleCAPIError();
788 }
789 return WasmEdge_String{/* Length */ 0, /* Buf */ nullptr};
790}
791
792WASMEDGE_CAPI_EXPORT WasmEdge_String
793WasmEdge_StringWrap(const char *Buf, const uint32_t Len) noexcept {

Callers

nothing calls this directly

Calls 1

handleCAPIErrorFunction · 0.85

Tested by

no test coverage detected