Hello,
That function and the _writable_elements() version are broken for
shared arrays because they return a pointer to the beginning of the
enclosing array instead of a pointer to their own beginning.
This patch against master fixes the issue for me. Cf. the
implementation of scm_array_handle_uniform_writable_elements() in
uniform.c.
---
libguile/srfi-4.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libguile/srfi-4.c b/libguile/srfi-4.c
index 4b7eadc..f38fbcf 100644
--- a/libguile/srfi-4.c
+++ b/libguile/srfi-4.c
@@ -119,13 +119,13 @@
{ \
if (h->element_type != ETYPE
(TAG)) \
scm_wrong_type_arg_msg (NULL, 0, h->array, #tag
"vector"); \
- return h->elements; \
+ return h->elements+h->base*scm_array_handle_uniform_element_size
(h);\
}
\
ctype* scm_array_handle_##tag##_writable_elements
(scm_t_array_handle *h) \
{ \
if (h->element_type != ETYPE
(TAG)) \
scm_wrong_type_arg_msg (NULL, 0, h->array, #tag
"vector"); \
- return h->writable_elements; \
+ return h->writable_elements+h-
>base*scm_array_handle_uniform_element_size(h); \
}
\
const ctype *scm_##tag##vector_elements (SCM
uvec, \
scm_t_array_handle
*h, \
--
Thanks,
Daniel