From 7c77a7f02fc9c4c688381e823887a6bbf7ff1bd8 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 18 May 2017 20:13:20 -0700 Subject: ffi: unknown carray length represented as nil. * ffi.c (length_carray): Convert the internal representation of unknown length, which is a -1 of type cnum, into a nil return value. --- ffi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffi.c b/ffi.c index e5f70b3e..75a37ab8 100644 --- a/ffi.c +++ b/ffi.c @@ -2397,7 +2397,7 @@ val carray_type(val carray) val length_carray(val carray) { struct carray *scry = carray_struct_checked(carray); - return num(scry->nelem); + return if3(scry->nelem < 0, nil, num(scry->nelem)); } mem_t *carray_get(val carray, val type, val self) -- cgit v1.2.3