mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 15:13:28 +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 {
|
||||
_ = self;
|
||||
var cnamespace: ?[:0]const u8 = null;
|
||||
if (namespace != null) {
|
||||
cnamespace = try allocator.dupeZ(u8, namespace.?);
|
||||
if (namespace) |ns| {
|
||||
cnamespace = try allocator.dupeZ(u8, ns);
|
||||
defer allocator.free(cnamespace.?);
|
||||
}
|
||||
|
||||
var cqname: ?[:0]const u8 = null;
|
||||
if (qname != null) {
|
||||
cqname = try allocator.dupeZ(u8, qname.?);
|
||||
if (qname) |qn| {
|
||||
cqname = try allocator.dupeZ(u8, qn);
|
||||
defer allocator.free(cqname.?);
|
||||
}
|
||||
|
||||
|
||||
@@ -831,13 +831,13 @@ pub inline fn domImplementationCreateDocument(namespace: ?[:0]const u8, qname: ?
|
||||
var doc: ?*Document = undefined;
|
||||
|
||||
var ptrnamespace: [*c]const u8 = null;
|
||||
if (namespace != null) {
|
||||
ptrnamespace = namespace.?.ptr;
|
||||
if (namespace) |ns| {
|
||||
ptrnamespace = ns.ptr;
|
||||
}
|
||||
|
||||
var ptrqname: [*c]const u8 = null;
|
||||
if (qname != null) {
|
||||
ptrqname = qname.?.ptr;
|
||||
if (qname) |qn| {
|
||||
ptrqname = qn.ptr;
|
||||
}
|
||||
|
||||
_ = c.dom_implementation_create_document(
|
||||
|
||||
Reference in New Issue
Block a user