tustvold commented on code in PR #3687:
URL: https://github.com/apache/arrow-rs/pull/3687#discussion_r1102621139


##########
arrow/src/ffi.rs:
##########
@@ -592,38 +219,13 @@ unsafe fn create_buffer(
     index: usize,
     len: usize,
 ) -> Option<Buffer> {
-    if array.buffers.is_null() || array.n_buffers == 0 {
+    if array.num_buffers() == 0 {
         return None;
     }
-    let buffers = array.buffers as *mut *const u8;
-
-    assert!(index < array.n_buffers as usize);
-    let ptr = *buffers.add(index);
-
-    NonNull::new(ptr as *mut u8)
+    NonNull::new(array.buffer(index) as _)
         .map(|ptr| Buffer::from_custom_allocation(ptr, len, owner))
 }
 
-fn create_child(

Review Comment:
   This method was previously incorrect as it coerced non-static borrows to 
static borrows. Fortunately it can be removed without any change to the public 
interface



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to