You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by pa...@apache.org on 2022/12/02 13:41:12 UTC

[arrow-nanoarrow] branch main updated: Use strict prototypes (#79)

This is an automated email from the ASF dual-hosted git repository.

paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 3a04ea0  Use strict prototypes (#79)
3a04ea0 is described below

commit 3a04ea08fe636b0ba58bd7c29575570d37266092
Author: Dewey Dunnington <de...@fishandwhistle.net>
AuthorDate: Fri Dec 2 09:41:07 2022 -0400

    Use strict prototypes (#79)
---
 examples/cmake-minimal/src/library.c    |  2 +-
 examples/cmake-minimal/src/library.h    |  2 +-
 examples/vendored-minimal/src/library.c |  7 ++++---
 examples/vendored-minimal/src/library.h |  2 +-
 r/src/array.h                           |  2 +-
 r/src/array_stream.h                    |  2 +-
 r/src/build_id.c                        |  4 ++--
 r/src/init.c                            | 10 +++++-----
 r/src/pointers.c                        |  6 +++---
 r/src/schema.h                          |  2 +-
 r/src/util.c                            |  2 +-
 r/src/util.h                            |  2 +-
 r/tools/make-callentries.R              |  2 +-
 src/nanoarrow/nanoarrow.h               |  4 ++--
 src/nanoarrow/utils.c                   |  4 ++--
 15 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/examples/cmake-minimal/src/library.c b/examples/cmake-minimal/src/library.c
index ba23507..9639f1a 100644
--- a/examples/cmake-minimal/src/library.c
+++ b/examples/cmake-minimal/src/library.c
@@ -26,7 +26,7 @@
 
 static struct ArrowError global_error;
 
-const char* my_library_last_error() { return ArrowErrorMessage(&global_error); }
+const char* my_library_last_error(void) { return ArrowErrorMessage(&global_error); }
 
 int make_simple_array(struct ArrowArray* array_out, struct ArrowSchema* schema_out) {
   ArrowErrorSet(&global_error, "");
diff --git a/examples/cmake-minimal/src/library.h b/examples/cmake-minimal/src/library.h
index c93f1ab..3c0faf6 100644
--- a/examples/cmake-minimal/src/library.h
+++ b/examples/cmake-minimal/src/library.h
@@ -111,7 +111,7 @@ struct ArrowArrayStream {
 #endif  // ARROW_C_STREAM_INTERFACE
 #endif  // ARROW_FLAG_DICTIONARY_ORDERED
 
-const char* my_library_last_error();
+const char* my_library_last_error(void);
 
 // Creates the integer array [1, 2, 3]
 int make_simple_array(struct ArrowArray* array_out, struct ArrowSchema* schema_out);
diff --git a/examples/vendored-minimal/src/library.c b/examples/vendored-minimal/src/library.c
index 9ddf7ad..07ef6ab 100644
--- a/examples/vendored-minimal/src/library.c
+++ b/examples/vendored-minimal/src/library.c
@@ -26,7 +26,7 @@
 
 static struct ArrowError global_error;
 
-const char* my_library_last_error() { return ArrowErrorMessage(&global_error); }
+const char* my_library_last_error(void) { return ArrowErrorMessage(&global_error); }
 
 int make_simple_array(struct ArrowArray* array_out, struct ArrowSchema* schema_out) {
   ArrowErrorSet(&global_error, "");
@@ -40,7 +40,7 @@ int make_simple_array(struct ArrowArray* array_out, struct ArrowSchema* schema_o
   NANOARROW_RETURN_NOT_OK(ArrowArrayAppendInt(array_out, 2));
   NANOARROW_RETURN_NOT_OK(ArrowArrayAppendInt(array_out, 3));
   NANOARROW_RETURN_NOT_OK(ArrowArrayFinishBuilding(array_out, &global_error));
-  
+
   NANOARROW_RETURN_NOT_OK(ArrowSchemaInit(schema_out, NANOARROW_TYPE_INT32));
 
   return NANOARROW_OK;
@@ -48,7 +48,8 @@ int make_simple_array(struct ArrowArray* array_out, struct ArrowSchema* schema_o
 
 int print_simple_array(struct ArrowArray* array, struct ArrowSchema* schema) {
   struct ArrowArrayView array_view;
-  NANOARROW_RETURN_NOT_OK(ArrowArrayViewInitFromSchema(&array_view, schema, &global_error));
+  NANOARROW_RETURN_NOT_OK(
+      ArrowArrayViewInitFromSchema(&array_view, schema, &global_error));
 
   if (array_view.storage_type != NANOARROW_TYPE_INT32) {
     printf("Array has storage that is not int32\n");
diff --git a/examples/vendored-minimal/src/library.h b/examples/vendored-minimal/src/library.h
index c93f1ab..3c0faf6 100644
--- a/examples/vendored-minimal/src/library.h
+++ b/examples/vendored-minimal/src/library.h
@@ -111,7 +111,7 @@ struct ArrowArrayStream {
 #endif  // ARROW_C_STREAM_INTERFACE
 #endif  // ARROW_FLAG_DICTIONARY_ORDERED
 
-const char* my_library_last_error();
+const char* my_library_last_error(void);
 
 // Creates the integer array [1, 2, 3]
 int make_simple_array(struct ArrowArray* array_out, struct ArrowSchema* schema_out);
diff --git a/r/src/array.h b/r/src/array.h
index 4167001..50dc500 100644
--- a/r/src/array.h
+++ b/r/src/array.h
@@ -66,7 +66,7 @@ static inline struct ArrowArray* nullable_array_from_xptr(SEXP array_xptr) {
 
 // Create an external pointer with the proper class and that will release any
 // non-null, non-released pointer when garbage collected.
-static inline SEXP array_owning_xptr() {
+static inline SEXP array_owning_xptr(void) {
   struct ArrowArray* array = (struct ArrowArray*)ArrowMalloc(sizeof(struct ArrowArray));
   array->release = NULL;
 
diff --git a/r/src/array_stream.h b/r/src/array_stream.h
index 816944d..28c9b06 100644
--- a/r/src/array_stream.h
+++ b/r/src/array_stream.h
@@ -48,7 +48,7 @@ static inline struct ArrowArrayStream* array_stream_from_xptr(SEXP array_stream_
 
 // Create an external pointer with the proper class and that will release any
 // non-null, non-released pointer when garbage collected.
-static inline SEXP array_stream_owning_xptr() {
+static inline SEXP array_stream_owning_xptr(void) {
   struct ArrowArrayStream* array_stream =
       (struct ArrowArrayStream*)ArrowMalloc(sizeof(struct ArrowArrayStream));
   array_stream->release = NULL;
diff --git a/r/src/build_id.c b/r/src/build_id.c
index 882b64a..32166de 100644
--- a/r/src/build_id.c
+++ b/r/src/build_id.c
@@ -21,10 +21,10 @@
 
 #include "nanoarrow.h"
 
-SEXP nanoarrow_c_build_id() {
+SEXP nanoarrow_c_build_id(void) {
   return Rf_mkString(NANOARROW_BUILD_ID);
 }
 
-SEXP nanoarrow_c_build_id_runtime() {
+SEXP nanoarrow_c_build_id_runtime(void) {
   return Rf_mkString(ArrowNanoarrowBuildId());
 }
diff --git a/r/src/init.c b/r/src/init.c
index 156ec6c..33c40ed 100644
--- a/r/src/init.c
+++ b/r/src/init.c
@@ -35,14 +35,14 @@ extern SEXP nanoarrow_c_infer_schema_array(SEXP array_xptr);
 extern SEXP nanoarrow_c_array_proxy(SEXP array_xptr, SEXP array_view_xptr, SEXP recursive_sexp);
 extern SEXP nanoarrow_c_buffer_info(SEXP buffer_xptr);
 extern SEXP nanoarrow_c_buffer_as_raw(SEXP buffer_xptr);
-extern SEXP nanoarrow_c_build_id();
-extern SEXP nanoarrow_c_build_id_runtime();
+extern SEXP nanoarrow_c_build_id(void);
+extern SEXP nanoarrow_c_build_id_runtime(void);
 extern SEXP nanoarrow_c_convert_array_stream(SEXP array_stream_xptr, SEXP ptype_sexp, SEXP size_sexp, SEXP n_sexp);
 extern SEXP nanoarrow_c_convert_array(SEXP array_xptr, SEXP ptype_sexp);
 extern SEXP nanoarrow_c_infer_ptype(SEXP schema_xptr);
-extern SEXP nanoarrow_c_allocate_schema();
-extern SEXP nanoarrow_c_allocate_array();
-extern SEXP nanoarrow_c_allocate_array_stream();
+extern SEXP nanoarrow_c_allocate_schema(void);
+extern SEXP nanoarrow_c_allocate_array(void);
+extern SEXP nanoarrow_c_allocate_array_stream(void);
 extern SEXP nanoarrow_c_pointer(SEXP obj_sexp);
 extern SEXP nanoarrow_c_pointer_addr_dbl(SEXP ptr);
 extern SEXP nanoarrow_c_pointer_addr_chr(SEXP ptr);
diff --git a/r/src/pointers.c b/r/src/pointers.c
index 7441322..8d118ab 100644
--- a/r/src/pointers.c
+++ b/r/src/pointers.c
@@ -26,11 +26,11 @@
 // More reliable way to stringify intptr_t on Windows using C++
 void intptr_as_string(intptr_t ptr_int, char* buf);
 
-SEXP nanoarrow_c_allocate_schema() { return schema_owning_xptr(); }
+SEXP nanoarrow_c_allocate_schema(void) { return schema_owning_xptr(); }
 
-SEXP nanoarrow_c_allocate_array() { return array_owning_xptr(); }
+SEXP nanoarrow_c_allocate_array(void) { return array_owning_xptr(); }
 
-SEXP nanoarrow_c_allocate_array_stream() { return array_stream_owning_xptr(); }
+SEXP nanoarrow_c_allocate_array_stream(void) { return array_stream_owning_xptr(); }
 
 SEXP nanoarrow_c_pointer(SEXP obj_sexp) {
   if (TYPEOF(obj_sexp) == EXTPTRSXP) {
diff --git a/r/src/schema.h b/r/src/schema.h
index 54bf4fa..c1ec55b 100644
--- a/r/src/schema.h
+++ b/r/src/schema.h
@@ -63,7 +63,7 @@ static inline struct ArrowSchema* nullable_schema_from_xptr(SEXP schema_xptr) {
 
 // Create an external pointer with the proper class and that will release any
 // non-null, non-released pointer when garbage collected.
-static inline SEXP schema_owning_xptr() {
+static inline SEXP schema_owning_xptr(void) {
   struct ArrowSchema* schema =
       (struct ArrowSchema*)ArrowMalloc(sizeof(struct ArrowSchema));
   if (schema == NULL) {
diff --git a/r/src/util.c b/r/src/util.c
index 9e55a37..1f71a06 100644
--- a/r/src/util.c
+++ b/r/src/util.c
@@ -29,7 +29,7 @@ SEXP nanoarrow_cls_data_frame = NULL;
 SEXP nanoarrow_cls_schema = NULL;
 SEXP nanoarrow_cls_array_stream = NULL;
 
-void nanoarrow_init_cached_sexps() {
+void nanoarrow_init_cached_sexps(void) {
   SEXP nanoarrow_str = PROTECT(Rf_mkString("nanoarrow"));
   nanoarrow_ns_pkg = PROTECT(R_FindNamespace(nanoarrow_str));
   nanoarrow_cls_array = PROTECT(Rf_mkString("nanoarrow_array")); 
diff --git a/r/src/util.h b/r/src/util.h
index 18e16b1..acd546e 100644
--- a/r/src/util.h
+++ b/r/src/util.h
@@ -29,6 +29,6 @@ extern SEXP nanoarrow_cls_data_frame;
 extern SEXP nanoarrow_cls_schema;
 extern SEXP nanoarrow_cls_array_stream;
 
-void nanoarrow_init_cached_sexps();
+void nanoarrow_init_cached_sexps(void);
 
 #endif
diff --git a/r/tools/make-callentries.R b/r/tools/make-callentries.R
index 572f9cf..40e5151 100644
--- a/r/tools/make-callentries.R
+++ b/r/tools/make-callentries.R
@@ -38,7 +38,7 @@ defs <- tibble(
     str_remove("SEXP nanoarrow_c_[^\\(]+\\(") %>%
     str_remove("\\)$") %>%
     str_split("\\s*,\\s*") %>%
-    map(~{if(identical(.x, "")) character(0) else .x}),
+    map(~{if(identical(.x, "") || identical(.x, "void")) character(0) else .x}),
   n_args = map(args, length)
 )
 
diff --git a/src/nanoarrow/nanoarrow.h b/src/nanoarrow/nanoarrow.h
index d22cb8d..6d2c059 100644
--- a/src/nanoarrow/nanoarrow.h
+++ b/src/nanoarrow/nanoarrow.h
@@ -140,7 +140,7 @@ void ArrowFree(void* ptr);
 ///
 /// The default allocator uses ArrowMalloc(), ArrowRealloc(), and
 /// ArrowFree().
-struct ArrowBufferAllocator ArrowBufferAllocatorDefault();
+struct ArrowBufferAllocator ArrowBufferAllocatorDefault(void);
 
 /// \brief Create a custom deallocator
 ///
@@ -184,7 +184,7 @@ const char* ArrowErrorMessage(struct ArrowError* error);
 /// @{
 
 /// \brief Return the build id against which the library was compiled
-const char* ArrowNanoarrowBuildId();
+const char* ArrowNanoarrowBuildId(void);
 
 /// \brief Initialize a description of buffer arrangements from a storage type
 void ArrowLayoutInit(struct ArrowLayout* layout, enum ArrowType storage_type);
diff --git a/src/nanoarrow/utils.c b/src/nanoarrow/utils.c
index b87fa65..1db2835 100644
--- a/src/nanoarrow/utils.c
+++ b/src/nanoarrow/utils.c
@@ -24,7 +24,7 @@
 
 #include "nanoarrow.h"
 
-const char* ArrowNanoarrowBuildId() { return NANOARROW_BUILD_ID; }
+const char* ArrowNanoarrowBuildId(void) { return NANOARROW_BUILD_ID; }
 
 int ArrowErrorSet(struct ArrowError* error, const char* fmt, ...) {
   if (error == NULL) {
@@ -178,7 +178,7 @@ static void ArrowBufferAllocatorMallocFree(struct ArrowBufferAllocator* allocato
 static struct ArrowBufferAllocator ArrowBufferAllocatorMalloc = {
     &ArrowBufferAllocatorMallocReallocate, &ArrowBufferAllocatorMallocFree, NULL};
 
-struct ArrowBufferAllocator ArrowBufferAllocatorDefault() {
+struct ArrowBufferAllocator ArrowBufferAllocatorDefault(void) {
   return ArrowBufferAllocatorMalloc;
 }