add nullable ada url functions

not fully sure how we should implement those; I believe we should move forward with nullable functions and put null-check logic outside of the wrappers
This commit is contained in:
Halil Durak
2025-10-17 15:48:28 +03:00
parent c930d942fe
commit 4c4feef9fc

8
vendor/ada/root.zig vendored
View File

@@ -63,6 +63,10 @@ pub inline fn getOrigin(url: URL) []const u8 {
return origin.data[0..origin.length]; return origin.data[0..origin.length];
} }
pub inline fn getOriginNullable(url: URL) OwnedString {
return c.ada_get_origin(url);
}
pub inline fn getHrefNullable(url: URL) String { pub inline fn getHrefNullable(url: URL) String {
return c.ada_get_href(url); return c.ada_get_href(url);
} }
@@ -79,6 +83,10 @@ pub inline fn getPassword(url: URL) []const u8 {
return password.data[0..password.length]; return password.data[0..password.length];
} }
pub inline fn getPortNullable(url: URL) String {
return c.ada_get_port(url);
}
pub inline fn getPort(url: URL) []const u8 { pub inline fn getPort(url: URL) []const u8 {
if (!c.ada_has_port(url)) { if (!c.ada_has_port(url)) {
return ""; return "";