Skip to content

Commit 4de6ad0

Browse files
node: move arg check in API declaration for nodeLookupPrefix method
Signed-off-by: Francis Bouvier <[email protected]>
1 parent bbcd9d8 commit 4de6ad0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/dom/node.zig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@ pub const Node = struct {
178178

179179
pub fn _lookupPrefix(self: *parser.Node, namespace: ?[]const u8) ?[]const u8 {
180180
// TODO: other is not an optional parameter, but can be null.
181+
if (namespace == null) {
182+
return null;
183+
}
184+
if (std.mem.eql(u8, namespace.?, "")) {
185+
return null;
186+
}
181187
return parser.nodeLookupPrefix(self, namespace);
182188
}
183189

src/netsurf.zig

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,15 +383,9 @@ pub fn nodeIsSameNode(node: *Node, other: *Node) bool {
383383
return res;
384384
}
385385

386-
pub fn nodeLookupPrefix(node: *Node, namespace: ?[]const u8) ?[]const u8 {
387-
if (namespace == null) {
388-
return null;
389-
}
390-
if (std.mem.eql(u8, namespace.?, "")) {
391-
return null;
392-
}
386+
pub fn nodeLookupPrefix(node: *Node, namespace: []const u8) ?[]const u8 {
393387
var s: ?*String = undefined;
394-
_ = nodeVtable(node).dom_node_lookup_prefix.?(node, stringFromData(namespace.?), &s);
388+
_ = nodeVtable(node).dom_node_lookup_prefix.?(node, stringFromData(namespace), &s);
395389
if (s == null) {
396390
return null;
397391
}

0 commit comments

Comments
 (0)