diff options
Diffstat (limited to 'libguile')
-rw-r--r-- | libguile/array-handle.c | 6 | ||||
-rw-r--r-- | libguile/array-map.c | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/libguile/array-handle.c b/libguile/array-handle.c index 3d81efc04..947462a59 100644 --- a/libguile/array-handle.c +++ b/libguile/array-handle.c @@ -149,8 +149,10 @@ initialize_vector_handle (scm_t_array_handle *h, size_t len, h->dim0.ubnd = (ssize_t) (len - 1U); h->dim0.inc = 1; h->element_type = element_type; - h->elements = elements; - h->writable_elements = mutable_p ? ((void *) elements) : NULL; + /* elements != writable_elements is used to check mutability later on. + Ignore it if the array is empty. */ + h->elements = len==0 ? NULL : elements; + h->writable_elements = mutable_p ? ((void *) h->elements) : NULL; h->vector = h->array; h->vref = vref; h->vset = vset; 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]; |