mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-01 15:20:34 +02:00
Remove undocumented casting behavior in srfi4 vector_elements
* libguile/srfi-4.c: scm_##tag##vector_writable_elements: if the argument's type doesn't match the tag, throw type error.
This commit is contained in:
parent
9cbd17fc50
commit
95cd688421
1 changed files with 1 additions and 21 deletions
|
@ -142,27 +142,7 @@
|
|||
return ((ctype*)h->writable_elements) + h->base*width; \
|
||||
/* otherwise... */ \
|
||||
else \
|
||||
{ \
|
||||
size_t sfrom, sto, lfrom, lto; \
|
||||
if (h->dims != &h->dim0) \
|
||||
{ \
|
||||
h->dim0 = h->dims[0]; \
|
||||
h->dims = &h->dim0; \
|
||||
} \
|
||||
sfrom = scm_i_array_element_type_sizes [h->element_type]; \
|
||||
sto = scm_i_array_element_type_sizes [ETYPE (TAG)]; \
|
||||
lfrom = h->dim0.ubnd - h->dim0.lbnd + 1; \
|
||||
lto = lfrom * sfrom / sto; \
|
||||
if (lto * sto != lfrom * sfrom) \
|
||||
{ \
|
||||
scm_array_handle_release (h); \
|
||||
scm_wrong_type_arg (#tag"vector-elements", SCM_ARG1, uvec); \
|
||||
} \
|
||||
h->dim0.ubnd = h->dim0.lbnd + lto; \
|
||||
h->base = h->base * sto / sfrom; \
|
||||
h->element_type = ETYPE (TAG); \
|
||||
return ((ctype*)h->writable_elements) + h->base*width; \
|
||||
} \
|
||||
scm_wrong_type_arg_msg (NULL, 0, h->array, #tag "vector"); \
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue