lloda pushed a commit to branch wip-vector-cleanup
in repository guile.

commit d828ab8ef1944f752597157b78b2c609984e6f17
Author: Daniel Llorens <ll...@sarc.name>
AuthorDate: Mon Feb 3 13:24:03 2020 +0100

    Remove the unused argument from scm_array_p
    
    * libguile/generalized-arrays.h:
    * libguile/generalized-arrays.c: As stated.
    * doc/ref/api-data.texi: Fix documentation.
    * NEWS-array-fixes.txt: Document branch changes.
---
 NEWS-array-fixes.txt          | 28 ++++++++++++++++++++++++++++
 doc/ref/api-data.texi         |  6 +-----
 libguile/generalized-arrays.c | 13 ++-----------
 libguile/generalized-arrays.h |  5 ++---
 4 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/NEWS-array-fixes.txt b/NEWS-array-fixes.txt
new file mode 100644
index 0000000..6d97a52
--- /dev/null
+++ b/NEWS-array-fixes.txt
@@ -0,0 +1,28 @@
+
+TBA to NEWS for this branch.
+ 
+* Forward incompatible changes
+
+Applying these changes will make your program work with this version of
+Guile and continue working with older versions.
+
+** vector->list and vector-copy require a true vector argument.
+
+Use array->list and array-copy (from (ice-9 arrays)) on general arrays.
+
+** scm_vector_elements / scm_vector_writable_elements require a true vector 
argument.
+
+Use scm_array_get_handle and scm_array_handle_elements /
+scm_array_handle_writable_elements on general arrays.
+
+* Backward incompatible changes
+
+Applying these changes will make your program work with this version of
+Guile and STOP working with older versions.
+
+** scm_array_p takes a single argument.
+
+This function used to take a second unused argument for the sake of
+compatibility with older versions of Guile. Just remove this argument from your
+calls.
+
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index 750f711..c70e3e2 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -7327,13 +7327,9 @@ values, one for each dimension.
 
 
 @deffn {Scheme Procedure} array? obj
-@deffnx {C Function} scm_array_p (obj, unused)
+@deffnx {C Function} scm_array_p (obj)
 Return @code{#t} if the @var{obj} is an array, and @code{#f} if
 not.
-
-The second argument to scm_array_p is there for historical reasons,
-but it is not used.  You should always pass @code{SCM_UNDEFINED} as
-its value.
 @end deffn
 
 @deffn {Scheme Procedure} typed-array? obj type
diff --git a/libguile/generalized-arrays.c b/libguile/generalized-arrays.c
index 28ca6b3..a48012f 100644
--- a/libguile/generalized-arrays.c
+++ b/libguile/generalized-arrays.c
@@ -62,25 +62,16 @@ scm_is_array (SCM obj)
     }
 }
 
-SCM_DEFINE (scm_array_p_2, "array?", 1, 0, 0,
+SCM_DEFINE (scm_array_p, "array?", 1, 0, 0,
            (SCM obj),
            "Return @code{#t} if the @var{obj} is an array, and @code{#f} if\n"
            "not.")
-#define FUNC_NAME s_scm_array_p_2
+#define FUNC_NAME s_scm_array_p
 {
   return scm_from_bool (scm_is_array (obj));
 }
 #undef FUNC_NAME
 
-/* The array type predicate, with an extra argument kept for backward
-   compatibility.  Note that we can't use `SCM_DEFINE' directly because there
-   would be an argument count mismatch that would be caught by
-   `snarf-check-and-output-texi.scm'.  */
-SCM
-scm_array_p (SCM obj, SCM unused)
-{
-  return scm_array_p_2 (obj);
-}
 
 int
 scm_is_typed_array (SCM obj, SCM type)
diff --git a/libguile/generalized-arrays.h b/libguile/generalized-arrays.h
index 130807b..5e7e981 100644
--- a/libguile/generalized-arrays.h
+++ b/libguile/generalized-arrays.h
@@ -35,7 +35,7 @@
 #define SCM_VALIDATE_ARRAY(pos, v) \
   do { \
     SCM_ASSERT (SCM_HEAP_OBJECT_P (v) \
-                && scm_is_true (scm_array_p (v, SCM_UNDEFINED)), \
+                && scm_is_true (scm_array_p (v)), \
                 v, pos, FUNC_NAME); \
   } while (0)
 
@@ -43,8 +43,7 @@
 /** Arrays */
 
 SCM_API int scm_is_array (SCM obj);
-SCM_API SCM scm_array_p (SCM v, SCM unused);
-SCM_INTERNAL SCM scm_array_p_2 (SCM);
+SCM_API SCM scm_array_p (SCM v);
 
 SCM_API int scm_is_typed_array (SCM obj, SCM type);
 SCM_API SCM scm_typed_array_p (SCM v, SCM type);

Reply via email to