guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 02/25: Remove scm_from_contiguous_array


From: Daniel Llorens
Subject: [Guile-commits] 02/25: Remove scm_from_contiguous_array
Date: Mon, 11 Jul 2016 08:21:10 +0000 (UTC)

lloda pushed a commit to branch lloda-array-support
in repository guile.

commit c557ff68ec84bc29caff45ca71dfe7fc07979059
Author: Daniel Llorens <address@hidden>
Date:   Mon Feb 9 17:27:33 2015 +0100

    Remove scm_from_contiguous_array
    
    This function is undocumented, unused within Guile, and can be trivially
    replaced by make-array + array-copy without requiring contiguity.
    
    * libguile/arrays.h (scm_from_contiguous_array): remove declaration.
    
    * libguile/arrays.c (scm_from_contiguous_array): remove.
---
 libguile/arrays.c |   35 -----------------------------------
 libguile/arrays.h |    2 --
 2 files changed, 37 deletions(-)

diff --git a/libguile/arrays.c b/libguile/arrays.c
index 05f8597..6613542 100644
--- a/libguile/arrays.c
+++ b/libguile/arrays.c
@@ -270,41 +270,6 @@ scm_from_contiguous_typed_array (SCM type, SCM bounds, 
const void *bytes,
 }
 #undef FUNC_NAME
 
-SCM
-scm_from_contiguous_array (SCM bounds, const SCM *elts, size_t len)
-#define FUNC_NAME "scm_from_contiguous_array"
-{
-  size_t k, rlen = 1;
-  scm_t_array_dim *s;
-  SCM ra;
-  scm_t_array_handle h;
-
-  ra = scm_i_shap2ra (bounds);
-  SCM_SET_ARRAY_CONTIGUOUS_FLAG (ra);
-  s = SCM_I_ARRAY_DIMS (ra);
-  k = SCM_I_ARRAY_NDIM (ra);
-
-  while (k--)
-    {
-      s[k].inc = rlen;
-      SCM_ASSERT_RANGE (1, bounds, s[k].lbnd <= s[k].ubnd + 1);
-      rlen = (s[k].ubnd - s[k].lbnd + 1) * s[k].inc;
-    }
-  if (rlen != len)
-    SCM_MISC_ERROR ("element length and dimensions do not match", SCM_EOL);
-
-  SCM_I_ARRAY_SET_V (ra, scm_c_make_vector (rlen, SCM_UNDEFINED));
-  scm_array_get_handle (ra, &h);
-  memcpy (h.writable_elements, elts, rlen * sizeof(SCM));
-  scm_array_handle_release (&h);
-
-  if (1 == SCM_I_ARRAY_NDIM (ra) && 0 == SCM_I_ARRAY_BASE (ra))
-    if (0 == s->lbnd)
-      return SCM_I_ARRAY_V (ra);
-  return ra;
-}
-#undef FUNC_NAME
-
 SCM_DEFINE (scm_make_array, "make-array", 1, 0, 1,
            (SCM fill, SCM bounds),
            "Create and return an array.")
diff --git a/libguile/arrays.h b/libguile/arrays.h
index 5f40597..c486f20 100644
--- a/libguile/arrays.h
+++ b/libguile/arrays.h
@@ -37,8 +37,6 @@
 /** Arrays */
 
 SCM_API SCM scm_make_array (SCM fill, SCM bounds);
-SCM_API SCM scm_from_contiguous_array (SCM bounds, const SCM *elts,
-                                       size_t len);
 SCM_API SCM scm_make_typed_array (SCM type, SCM fill, SCM bounds);
 SCM_API SCM scm_from_contiguous_typed_array (SCM type, SCM bounds,
                                              const void *bytes,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]