Re: [PATCH v4 06/11] rust: xarray: add `find_next` and `find_next_mut`

Daniel Almeida <[email protected]>
Newsgroups org.kernel.vger.rust-for-linux,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
Hi Andreas,

I wonder if we can't hoist most of these calls accessing self.state.state to
the XArrayState directly? For example, I see this in a couple of places:

+            bindings::xas_result(
+                &mut self.state.state,
+                bindings::xa_zero_to_null(bindings::xas_store(
+                    &mut self.state.state,
+                    core::ptr::null_mut(),
+                )),
+            )


How about XArrayState::replace(new: *mut c_void) -> *mut c_void?

Also:

+                state.state.xa_node = bindings::XAS_RESTART as *mut bindings::xa_node;
+                state.state.xa_index = 0;

Could be e.g.: "restart_at(index)”.


WDYT?

— Daniel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.