summaryrefslogtreecommitdiff
path: root/libguile/array-map.c
diff options
context:
space:
mode:
authorDaniel Llorens <daniel.llorens@bluewin.ch>2017-09-15 12:36:57 +0200
committerDaniel Llorens <daniel.llorens@bluewin.ch>2017-10-31 13:23:17 +0100
commit4212f29655db2e9ddca19ebd590bca5521c1b97b (patch)
tree962aafd11f614e068cdae1da2c54f8fb626e82b4 /libguile/array-map.c
parent1008ea315483d1fb41b2a8c10680e511238836d0 (diff)
downloadguile-4212f29655db2e9ddca19ebd590bca5521c1b97b.tar.gz
Allow scm_XXX_writable_elements on empty vectors, even if immutable
* libguile/array-handle.c (initialize_vector_handle): Set both element pointers to NULL if the vector is empty. * libguile/array-map.c (racp): Ignore immutability if destination is empty. * test-suite/tests/sort.test: Check empty/mutable/immutable vectors with sort!. * test-suite/tests/array-map.test: Check array-copy! with empty/immutable destination.
Diffstat (limited to 'libguile/array-map.c')
-rw-r--r--libguile/array-map.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libguile/array-map.c b/libguile/array-map.c
index 79383969d..651a1bfb9 100644
--- a/libguile/array-map.c
+++ b/libguile/array-map.c
@@ -263,7 +263,7 @@ racp (SCM src, SCM dst)
{
SCM const * el_s = h_s.elements;
SCM * el_d = h_d.writable_elements;
- if (!el_d)
+ if (!el_d && n>0)
scm_wrong_type_arg_msg ("array-copy!", SCM_ARG2, dst, "mutable array");
for (; n-- > 0; i_s += inc_s, i_d += inc_d)
el_d[i_d] = el_s[i_s];