diff options
| author | Onur Özkan <work@onurozkan.dev> | 2025-11-13 17:45:47 +0300 |
|---|---|---|
| committer | Miguel Ojeda <ojeda@kernel.org> | 2026-01-19 09:38:10 +0100 |
| commit | 2ad6c5cdc89acfefb01b84afa5e55262c40d6fec (patch) | |
| tree | 40197866451ae5c81e3a7238752c3dadea6d4c71 /tools/perf/lib/Documentation/tutorial/git@git.tavy.me:linux.git | |
| parent | 6c37b6841a92714eba4a7b7f823aea801da4e09f (diff) | |
rust: rbtree: reduce unsafe blocks on pointer derefs
Refactors parts of the get() and find_best_match()
traversal logic to minimize the scope of unsafe blocks
and avoid duplicating same safety comments.
One of the removed comments was also misleading:
// SAFETY: `node` is a non-null node...
Ordering::Equal => return Some(unsafe { &(*this).value }),
as `node` should have been `this`.
No functional changes intended; this is purely a safety
improvement that reduces the amount of unsafe blocks
while keeping all invariants intact.
[ Alice writes:
"One consequence of creating a &_ to the bindings::rb_node struct means
that we assert immutability for the entire struct and not just the
rb_left/rb_right fields, but I have verified that this is ok."
- Miguel ]
Signed-off-by: Onur Özkan <work@onurozkan.dev>
Reviewed-by: Charalampos Mitrodimas <charmitro@posteo.net>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20251113144547.502-1-work@onurozkan.dev
[ Reworded title and replaced `cursor_lower_bound()` with
`find_best_match()` in message. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'tools/perf/lib/Documentation/tutorial/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
