mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
*LinkedList.remove() assumes node is in the list
probably closes https://github.com/ziglang/zig/issues/16795
This commit is contained in:
parent
bd1e960bc0
commit
a83db33ba2
@ -105,6 +105,7 @@ pub fn prepend(list: *DoublyLinkedList, new_node: *Node) void {
|
||||
}
|
||||
|
||||
/// Remove a node from the list.
|
||||
/// Assumes the node is in the list.
|
||||
///
|
||||
/// Arguments:
|
||||
/// node: Pointer to the node to be removed.
|
||||
|
||||
@ -85,6 +85,8 @@ pub fn prepend(list: *SinglyLinkedList, new_node: *Node) void {
|
||||
list.first = new_node;
|
||||
}
|
||||
|
||||
/// Remove `node` from the list.
|
||||
/// Assumes `node` is in the list.
|
||||
pub fn remove(list: *SinglyLinkedList, node: *Node) void {
|
||||
if (list.first == node) {
|
||||
list.first = node.next;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user