MCPcopy Create free account
hub / github.com/NativeScript/android / ada_get_origin

Function ada_get_origin

test-app/runtime/src/main/cpp/ada/ada.cpp:17073–17086  ·  view source on GitHub ↗

caller must free the result with ada_free_owned_string

Source from the content-addressed store, hash-verified

17071
17072// caller must free the result with ada_free_owned_string
17073ada_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
17088void ada_free_owned_string(ada_owned_string owned) noexcept {
17089 delete[] owned.data;

Callers

nothing calls this directly

Calls 3

get_originMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected