| 776 | } |
| 777 | |
| 778 | WASMEDGE_CAPI_EXPORT WasmEdge_String |
| 779 | WasmEdge_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 | |
| 792 | WASMEDGE_CAPI_EXPORT WasmEdge_String |
| 793 | WasmEdge_StringWrap(const char *Buf, const uint32_t Len) noexcept { |
nothing calls this directly
no test coverage detected