Rewrite WUtils tree.c in Rust #6

Merged
trurl merged 3 commits from trurl/wmaker:refactor/wutil-rs-tree into refactor/wutil-rs 2025-12-08 12:59:49 -05:00
Owner

This reduces the surface area of the tree API because it's almost completely unused.

This reduces the surface area of the tree API because it's almost completely unused.
trurl added 3 commits 2025-10-31 22:17:28 -04:00
This is a first step towards migrating WINGs/tree.c to Rust.

Happy finding: no parent pointer are actually needed, so we don't have to use a
shared structure for node pointers!
WMTreeWalk is only called once, with depthFirst set to true, so we might as well
just hard-code that behavior.

Also, this parameter appears to have been misnamed (since the search is always DFS)
and should properly be named to indicate that it controls if this is a pre- or
post-order traversal.
This is a bit of a red herring, since WMTree is only used in wmmenugen, which I
don't think I've ever directly used. See notes at the top of tree.rs for more
musings on whether this should be in wutil-rs at all.
trurl changed title from Rewrite WUtils WMTreeNode in Rust to Rewrite WUtils tree.c in Rust 2025-11-01 10:17:05 -04:00
trurl requested review from cross 2025-11-01 10:39:01 -04:00
cross reviewed 2025-11-25 16:30:00 -05:00
@@ -0,0 +96,4 @@
}
let parent = unsafe { &mut *parent };
if tree.is_null() {
Member

I wonder about extracting this into a small function that wraps an Option or something? Probably not worth it.

I wonder about extracting this into a small function that wraps an `Option` or something? Probably not worth it.
Author
Owner

I think this is going to be replaced soon enough, so I'll merge as-is.

I think this is going to be replaced soon enough, so I'll merge as-is.
trurl marked this conversation as resolved
cross approved these changes 2025-11-25 16:34:56 -05:00
trurl force-pushed refactor/wutil-rs-tree from c598b034f5 to 9802b684ae 2025-12-08 12:59:26 -05:00 Compare
trurl merged commit 9802b684ae into refactor/wutil-rs 2025-12-08 12:59:49 -05:00
trurl deleted branch refactor/wutil-rs-tree 2025-12-08 12:59:50 -05:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vitrine/wmaker#6