Copilot commented on code in PR #221:
URL: https://github.com/apache/sedona-db/pull/221#discussion_r2429637829


##########
c/sedona-s2geography/src/geography_glue_bindgen.rs:
##########
@@ -14,9 +14,80 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#![allow(non_upper_case_globals)]
-#![allow(non_camel_case_types)]
-#![allow(non_snake_case)]
-#![allow(dead_code)]
 
-include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
+use std::os::raw::{c_char, c_int, c_void};
+
+#[repr(C)]
+pub struct ArrowSchema {
+    _private: [u8; 0],
+}
+
+#[repr(C)]
+pub struct ArrowArray {
+    _private: [u8; 0],
+}

Review Comment:
   Using zero-sized arrays with `_private: [u8; 0]` for opaque types is not the 
idiomatic approach in Rust. Consider using `std::ffi::c_void` or defining these 
as opaque structs with `#[repr(C)] pub struct ArrowSchema;` instead.
   ```suggestion
   pub struct ArrowSchema;
   
   #[repr(C)]
   pub struct ArrowArray;
   ```



##########
c/sedona-s2geography/src/geography_glue_bindgen.rs:
##########
@@ -14,9 +14,80 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
-#![allow(non_upper_case_globals)]
-#![allow(non_camel_case_types)]
-#![allow(non_snake_case)]
-#![allow(dead_code)]
 
-include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
+use std::os::raw::{c_char, c_int, c_void};
+
+#[repr(C)]
+pub struct ArrowSchema {
+    _private: [u8; 0],
+}
+
+#[repr(C)]
+pub struct ArrowArray {
+    _private: [u8; 0],
+}
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct SedonaGeographyArrowUdf {
+    pub init: Option<
+        unsafe extern "C" fn(
+            self_: *mut SedonaGeographyArrowUdf,
+            arg_schema: *mut ArrowSchema,
+            options: *const c_char,
+            out: *mut ArrowSchema,
+        ) -> c_int,
+    >,
+    pub execute: Option<
+        unsafe extern "C" fn(
+            self_: *mut SedonaGeographyArrowUdf,
+            args: *mut *mut ArrowArray,
+            n_args: i64,
+            out: *mut ArrowArray,
+        ) -> c_int,
+    >,
+    pub get_last_error:
+        Option<unsafe extern "C" fn(self_: *mut SedonaGeographyArrowUdf) -> 
*const c_char>,
+    pub release: Option<unsafe extern "C" fn(self_: *mut 
SedonaGeographyArrowUdf)>,
+    pub private_data: *mut c_void,
+}
+
+macro_rules! declare_s2_c_udfs {
+    ($($name:ident),*) => {
+        $(
+            paste::item! {
+                pub fn [<SedonaGeographyInitUdf $name>](out: *mut 
SedonaGeographyArrowUdf);

Review Comment:
   The macro-generated function declarations are missing the `unsafe extern 
\"C\"` qualifier. C function declarations in unsafe extern blocks should be 
consistent with their actual signatures.
   ```suggestion
                   pub unsafe extern "C" fn [<SedonaGeographyInitUdf 
$name>](out: *mut SedonaGeographyArrowUdf);
   ```



-- 
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