mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 12:20:20 +02:00
Fix breakage of SRFI-4 C accessors
* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Fix bad assumption that width was a byte width. Thanks very much to Barry Fishman for the report, and to Daniel Llorens for tracking it down. * test-suite/standalone/Makefile.am (test_srfi_4_CFLAGS): * test-suite/standalone/test-srfi-4.c: Add test.
This commit is contained in:
parent
92b793da2b
commit
2be7131ee0
3 changed files with 97 additions and 2 deletions
|
@ -137,12 +137,13 @@
|
|||
scm_t_array_handle *h, \
|
||||
size_t *lenp, ssize_t *incp) \
|
||||
{ \
|
||||
size_t byte_width = width * sizeof (ctype); \
|
||||
if (!scm_is_bytevector (uvec) \
|
||||
|| (scm_c_bytevector_length (uvec) % width)) \
|
||||
|| (scm_c_bytevector_length (uvec) % byte_width)) \
|
||||
scm_wrong_type_arg_msg (NULL, 0, uvec, #tag "vector"); \
|
||||
scm_array_get_handle (uvec, h); \
|
||||
if (lenp) \
|
||||
*lenp = scm_c_bytevector_length (uvec) / width; \
|
||||
*lenp = scm_c_bytevector_length (uvec) / byte_width; \
|
||||
if (incp) \
|
||||
*incp = 1; \
|
||||
return ((ctype *)h->writable_elements); \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue