| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (ffi_type_struct_destroy_op): Fix silly code.
The size field most certainly doesn't indicate the number
of elements, but rather the byte size. The array is
documented by libffi as null-pointer terminated, so let's take
advantage of that.
(make_ffi_type_struct): Speaking of the array being
null-terminated, it is we who are required to ensure this
representation and we are not. Let's fix it.
Also, we are here wrongly storing the number of elements
into the struct type's size field, which is the basis for
misusing that in the destroy op. The documentation says
that the size field should be initialized to zero.
|
|
|
|
|
|
| |
ffi.c (ffi_str_put, ffi_str_get, ffi_wstr_put, ffi_wstr_get):
Use assignment instead of memcpy to move the string pointer to
and from the buffer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* buf.c (make_duplicate_buf, buf_get, buf_fill): New
functions.
* buf.h (make_duplicate_buf, buf_get, buf_fill): Declared.
* ffi.c (struct txr_ffi_type): New member, nelem.
Keeps track of number of elements, for types that are
FFI pointers. This lets us support the get method so that
a buf can be a C function return value, if its size is
declared in our FFI type system.
(ffi_buf_put, ffi_buf_get, ffi_buf_fill): New functions.
(ffi_type_compile): Handle two new cases of syntax for
buffers: (buf <size>) and buf.
|
|
* Makefile (OBJS): Add ffi.o.
* configure (have_libffi): New variable.
(gen_config_make): Generate have_libffi make variable.
New check for availability of libffi.
* ffi.c, ffi.h: New files.
* lib.c (init): Call ffi_init.
|