summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-05-20 07:28:31 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-05-20 07:28:31 -0700
commit4b949beae1a22e2e4f9d9a61502754ae1bcfbd70 (patch)
tree62241c542a104e6757184b9386ca36c7bd7354e7
parenta6a5a200aff519d458d5582fdab776e30af40efc (diff)
downloadtxr-4b949beae1a22e2e4f9d9a61502754ae1bcfbd70.tar.gz
txr-4b949beae1a22e2e4f9d9a61502754ae1bcfbd70.tar.bz2
txr-4b949beae1a22e2e4f9d9a61502754ae1bcfbd70.zip
ffi: reorder initializations in carray-buf.
* ffi.c (carray_buf): Do the buf_get first, then length_buf, since buf_get takes a self argument. This way the diagnostic is better if the object isn't a buf.
-rw-r--r--ffi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ffi.c b/ffi.c
index 72d3ae35..c8819faf 100644
--- a/ffi.c
+++ b/ffi.c
@@ -2608,8 +2608,8 @@ val carray_blank(val nelem, val type)
val carray_buf(val buf, val type)
{
val self = lit("carray-buf");
- cnum blen = c_num(length_buf(buf));
mem_t *data = buf_get(buf, self);
+ cnum blen = c_num(length_buf(buf));
struct txr_ffi_type *tft = ffi_type_struct(type);
cnum nelem = if3(tft->size, blen / tft->size, 0);
return make_carray(type, data, nelem, buf);