Make List.next/List.prev nullable

libwayland sets these to null on removal
This commit is contained in:
Isaac Freund
2020-10-17 21:51:37 +02:00
parent 73b5763460
commit b21e255e02
+3 -3
View File
@@ -321,8 +321,8 @@ pub const ProtocolLogger = opaque {
};
pub const List = extern struct {
prev: *List,
next: *List,
prev: ?*List,
next: ?*List,
pub fn init(list: *List) void {
list.* = .{ .prev = list, .next = list };
@@ -342,7 +342,7 @@ pub const List = extern struct {
pub fn remove(elm: *elm) void {
elm.prev.next = elm.next;
elm.next.prev = elm.prev;
elm = undefined;
elm.* = .{ .prev = null, .next = null };
}
pub fn length(list: *const List) usize {