diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-05-07 19:45:17 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-05-07 19:45:17 -0700 |
commit | 3c78e9ea75c2c28bafbc598a6c1c1f615ea63623 (patch) | |
tree | c2a5c0e978854041234515ea1529974da83d286d | |
parent | 174f71b43cf3fa30a95f852bfdc1f6549f0d636a (diff) | |
download | txr-3c78e9ea75c2c28bafbc598a6c1c1f615ea63623.tar.gz txr-3c78e9ea75c2c28bafbc598a6c1c1f615ea63623.tar.bz2 txr-3c78e9ea75c2c28bafbc598a6c1c1f615ea63623.zip |
ffi: varray: write out all elements of Lisp seq.
* ffi.c (ffi_array_put, ffi_array_out): If dealign with
a variable array that is null terminated, let's add one to
nelem, so that all elements of the Lisp sequence are
converted, and then a null.
-rw-r--r-- | ffi.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1070,8 +1070,8 @@ static void ffi_array_put(struct txr_ffi_type *tft, val vec, mem_t *dst, val eltype = tft->mtypes; struct txr_ffi_type *etft = ffi_type_struct(eltype); cnum elsize = etft->size; - cnum i, nelem = if3(tft->is_varray, c_num(length(vec)), tft->nelem); int nt = tft->null_term; + cnum i, nelem = if3(tft->is_varray, c_num(length(vec)) + nt, tft->nelem); ucnum offs = 0; for (i = 0; i < nelem; i++) { @@ -1092,8 +1092,8 @@ static void ffi_array_out(struct txr_ffi_type *tft, int copy, val vec, val eltype = tft->mtypes; struct txr_ffi_type *etft = ffi_type_struct(eltype); cnum elsize = etft->size; - cnum i, nelem = if3(tft->is_varray, c_num(length(vec)), tft->nelem); int nt = tft->null_term; + cnum i, nelem = if3(tft->is_varray, c_num(length(vec)) + nt, tft->nelem); ucnum offs = 0; for (i = 0; i < nelem; i++) { |