node: move arg check in API declaration for nodeLookupPrefix method

Signed-off-by: Francis Bouvier <francis.bouvier@gmail.com>
This commit is contained in:
Francis Bouvier
2023-09-29 13:42:39 +02:00
parent bbcd9d8dcf
commit 4de6ad02f5
2 changed files with 8 additions and 8 deletions

View File

@@ -178,6 +178,12 @@ pub const Node = struct {
pub fn _lookupPrefix(self: *parser.Node, namespace: ?[]const u8) ?[]const u8 { pub fn _lookupPrefix(self: *parser.Node, namespace: ?[]const u8) ?[]const u8 {
// TODO: other is not an optional parameter, but can be null. // TODO: other is not an optional parameter, but can be null.
if (namespace == null) {
return null;
}
if (std.mem.eql(u8, namespace.?, "")) {
return null;
}
return parser.nodeLookupPrefix(self, namespace); return parser.nodeLookupPrefix(self, namespace);
} }

View File

@@ -383,15 +383,9 @@ pub fn nodeIsSameNode(node: *Node, other: *Node) bool {
return res; return res;
} }
pub fn nodeLookupPrefix(node: *Node, namespace: ?[]const u8) ?[]const u8 { pub fn nodeLookupPrefix(node: *Node, namespace: []const u8) ?[]const u8 {
if (namespace == null) {
return null;
}
if (std.mem.eql(u8, namespace.?, "")) {
return null;
}
var s: ?*String = undefined; var s: ?*String = undefined;
_ = nodeVtable(node).dom_node_lookup_prefix.?(node, stringFromData(namespace.?), &s); _ = nodeVtable(node).dom_node_lookup_prefix.?(node, stringFromData(namespace), &s);
if (s == null) { if (s == null) {
return null; return null;
} }