caller must free the result with ada_free_owned_string
| 17071 | |
| 17072 | // caller must free the result with ada_free_owned_string |
| 17073 | ada_owned_string ada_get_origin(ada_url result) noexcept { |
| 17074 | ada::result<ada::url_aggregator>& r = get_instance(result); |
| 17075 | ada_owned_string owned{}; |
| 17076 | if (!r) { |
| 17077 | owned.data = nullptr; |
| 17078 | owned.length = 0; |
| 17079 | return owned; |
| 17080 | } |
| 17081 | std::string out = r->get_origin(); |
| 17082 | owned.length = out.size(); |
| 17083 | owned.data = new char[owned.length]; |
| 17084 | memcpy((void*)owned.data, out.data(), owned.length); |
| 17085 | return owned; |
| 17086 | } |
| 17087 | |
| 17088 | void ada_free_owned_string(ada_owned_string owned) noexcept { |
| 17089 | delete[] owned.data; |
nothing calls this directly
no test coverage detected