diff options
author | Daniel Llorens <daniel.llorens@bluewin.ch> | 2013-04-12 15:04:52 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2014-01-27 21:45:18 +0100 |
commit | ba7e018b614f0964961dd14c877646d385da3a31 (patch) | |
tree | 3df2023b294f351c432071bfc167782e68928dfb /libguile/uniform.c | |
parent | 766f399d3b1a93e5c53768e5033de225b21aa6e1 (diff) | |
download | guile-ba7e018b614f0964961dd14c877646d385da3a31.tar.gz |
Match uniform_vector_elements with vector_elements
* libguile/vectors.c
- (scm_vector_writable_elements): allow any non-uniform rank 1 array,
after the doc. Match the implementation with scm_uniform_vector_elements.
- (scm_vector_elements): after the above.
* libguile/uniform.c
- (scm_uniform_vector_writable_elements): ditto for uniform rank 1 arrays.
* libguile/sort.c
- revert the changes in 7a6fd9, except for the argument type test; allow
what scm_vector_(writable_)elements allows.
Diffstat (limited to 'libguile/uniform.c')
-rw-r--r-- | libguile/uniform.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libguile/uniform.c b/libguile/uniform.c index 0be344d94..e6fcb531a 100644 --- a/libguile/uniform.c +++ b/libguile/uniform.c @@ -234,22 +234,14 @@ SCM_DEFINE (scm_uniform_vector_to_list, "uniform-vector->list", 1, 0, 0, } #undef FUNC_NAME -const void * -scm_uniform_vector_elements (SCM uvec, - scm_t_array_handle *h, - size_t *lenp, ssize_t *incp) -{ - return scm_uniform_vector_writable_elements (uvec, h, lenp, incp); -} - void * scm_uniform_vector_writable_elements (SCM uvec, scm_t_array_handle *h, size_t *lenp, ssize_t *incp) { - void *ret; - if (!scm_is_uniform_vector (uvec)) - scm_wrong_type_arg_msg (NULL, 0, uvec, "uniform vector"); + void * ret; + if (!scm_is_array (uvec) || 1 != scm_c_array_rank (uvec)) + scm_wrong_type_arg_msg (NULL, 0, uvec, "rank 1 uniform array"); scm_array_get_handle (uvec, h); /* FIXME nonlocal exit */ ret = scm_array_handle_uniform_writable_elements (h); @@ -262,7 +254,15 @@ scm_uniform_vector_writable_elements (SCM uvec, return ret; } -SCM_DEFINE (scm_uniform_vector_length, "uniform-vector-length", 1, 0, 0, +const void * +scm_uniform_vector_elements (SCM uvec, + scm_t_array_handle *h, + size_t *lenp, ssize_t *incp) +{ + return scm_uniform_vector_writable_elements (uvec, h, lenp, incp); +} + +SCM_DEFINE (scm_uniform_vector_length, "uniform-vector-length", 1, 0, 0, (SCM v), "Return the number of elements in the uniform vector @var{v}.") #define FUNC_NAME s_scm_uniform_vector_length |