From c557ff68ec84bc29caff45ca71dfe7fc07979059 Mon Sep 17 00:00:00 2001 From: Daniel Llorens Date: Mon, 9 Feb 2015 17:27:33 +0100 Subject: [PATCH] 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 05f85978a..66135425b 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 5f4059792..c486f2057 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,