mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 16:28:58 +00:00
better null check syntax
Co-authored-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
@@ -42,14 +42,14 @@ pub const DOMImplementation = struct {
|
|||||||
) !*parser.Document {
|
) !*parser.Document {
|
||||||
_ = self;
|
_ = self;
|
||||||
var cnamespace: ?[:0]const u8 = null;
|
var cnamespace: ?[:0]const u8 = null;
|
||||||
if (namespace != null) {
|
if (namespace) |ns| {
|
||||||
cnamespace = try allocator.dupeZ(u8, namespace.?);
|
cnamespace = try allocator.dupeZ(u8, ns);
|
||||||
defer allocator.free(cnamespace.?);
|
defer allocator.free(cnamespace.?);
|
||||||
}
|
}
|
||||||
|
|
||||||
var cqname: ?[:0]const u8 = null;
|
var cqname: ?[:0]const u8 = null;
|
||||||
if (qname != null) {
|
if (qname) |qn| {
|
||||||
cqname = try allocator.dupeZ(u8, qname.?);
|
cqname = try allocator.dupeZ(u8, qn);
|
||||||
defer allocator.free(cqname.?);
|
defer allocator.free(cqname.?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -831,13 +831,13 @@ pub inline fn domImplementationCreateDocument(namespace: ?[:0]const u8, qname: ?
|
|||||||
var doc: ?*Document = undefined;
|
var doc: ?*Document = undefined;
|
||||||
|
|
||||||
var ptrnamespace: [*c]const u8 = null;
|
var ptrnamespace: [*c]const u8 = null;
|
||||||
if (namespace != null) {
|
if (namespace) |ns| {
|
||||||
ptrnamespace = namespace.?.ptr;
|
ptrnamespace = ns.ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ptrqname: [*c]const u8 = null;
|
var ptrqname: [*c]const u8 = null;
|
||||||
if (qname != null) {
|
if (qname) |qn| {
|
||||||
ptrqname = qname.?.ptr;
|
ptrqname = qn.ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = c.dom_implementation_create_document(
|
_ = c.dom_implementation_create_document(
|
||||||
|
|||||||
Reference in New Issue
Block a user