commit a83db33ba2d5fddcc453735a7a0d9b57c67739a8 (tree)
parent bd1e960bc0d20013d9458d35318c46e40bd8ff59
Author: IOKG04 <iokg04@gmail.com>
Date: Tue, 12 Aug 2025 01:54:46 +0200
`*LinkedList.remove()` assumes node is in the list
probably closes https://github.com/ziglang/zig/issues/16795
Diffstat:
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/lib/std/DoublyLinkedList.zig b/lib/std/DoublyLinkedList.zig
@@ -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.
diff --git a/lib/std/SinglyLinkedList.zig b/lib/std/SinglyLinkedList.zig
@@ -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;