From 4b949beae1a22e2e4f9d9a61502754ae1bcfbd70 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 20 May 2017 07:28:31 -0700 Subject: 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. --- ffi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3