From 42e9af8981e3c82407d08754cdf89260b90ee4fb Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 25 May 2017 19:09:56 -0700 Subject: ffi: bugfix: remove nil slots when making struct. * ffi.c (ffi_type_compile): In the case when a struct type is compiled and the Lisp struct doesn't exist, the function creates the struct type. However, the FFI struct type syntax allows nil as a slot name, indicating a padding field. These nils must be scrubbed from the slot list when making the Lisp struct type, or else an error occurs. --- ffi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ffi.c b/ffi.c index 79f71538..59a68482 100644 --- a/ffi.c +++ b/ffi.c @@ -1659,7 +1659,8 @@ val ffi_type_compile(val syntax) val sname = if3(name, name, gensym(lit("ffi-struct-"))); val slots = ffi_struct_compile(membs, &types, self); val stype = or2(if2(name, find_struct_type(sname)), - make_struct_type(sname, nil, nil, slots, + make_struct_type(sname, nil, nil, + remq(nil, slots, nil), nil, nil, nil, nil)); val xsyntax = cons(struct_s, cons(sname, membs)); -- cgit v1.2.3