summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-05-25 19:09:56 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-05-25 19:09:56 -0700
commit761476fcb466b0dc8bfe35c71b873ebb7d2629a6 (patch)
treed1d9808642ba8b90643a783e566fc3e66c92cf26
parentfd402c48d244f7f823f18588bf67eda085b103e9 (diff)
downloadtxr-761476fcb466b0dc8bfe35c71b873ebb7d2629a6.tar.gz
txr-761476fcb466b0dc8bfe35c71b873ebb7d2629a6.tar.bz2
txr-761476fcb466b0dc8bfe35c71b873ebb7d2629a6.zip
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.
-rw-r--r--ffi.c3
1 files changed, 2 insertions, 1 deletions
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));