alamb commented on code in PR #11932:
URL: https://github.com/apache/arrow-rs/pull/11932#discussion_r4551603252


##########
arrow-schema/src/ffi.rs:
##########
@@ -184,16 +183,30 @@ impl FFI_ArrowSchema {
         Ok(this)
     }
 
-    /// Set the name of the schema
-    pub fn with_name(mut self, name: &str) -> Result<Self, ArrowError> {
-        self.name = CString::new(name)
-            .map_err(|e| {
-                ArrowError::CDataInterface(format!(
-                    "Null byte at position {} not allowed in name",
-                    e.nul_position()
-                ))
-            })?
-            .into_raw();
+    /// Set the name of the schema.
+    ///
+    /// # Errors
+    ///
+    /// Returns an error if `name` contains an interior nul byte.
+    ///
+    /// # Safety
+    ///
+    /// `self` must be a live schema produced by this crate (e.g. via
+    /// [`FFI_ArrowSchema::try_new`] or a `TryFrom`), with its original
+    /// `private_data`. It must not be a foreign schema or
+    /// [`FFI_ArrowSchema::empty`]. This method interprets `private_data` as
+    /// this crate's private storage.
+    pub unsafe fn with_name(mut self, name: &str) -> Result<Self, ArrowError> {

Review Comment:
   Good call. it means we need to wait for the next major release (61) before 
merging this



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to