mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-03-14 08:50:48 -07:00
dffi: fix bug in converting to :cstring's
We used the next argument instead of the current one. Bug identified and fixed by Christoph Buck. Fixes #523.
This commit is contained in:
parent
61e799074d
commit
2cbe875668
1 changed files with 4 additions and 2 deletions
|
|
@ -870,13 +870,15 @@ prepare_cif(cl_env_ptr the_env, ffi_cif *cif, cl_object return_type,
|
|||
the_env->ffi_types[++n] = ecl_type_to_libffi_type(arg_type);
|
||||
if (CONSP(args)) {
|
||||
cl_object object = ECL_CONS_CAR(args);
|
||||
args = ECL_CONS_CDR(args);
|
||||
if (type == ECL_FFI_CSTRING) {
|
||||
object = ecl_null_terminated_base_string(CAR(args));
|
||||
object = ecl_null_terminated_base_string(object);
|
||||
/* Push the newly allocated object onto the stack so that it
|
||||
* is reachable by the garbage collector */
|
||||
if (ECL_CONS_CAR(args) != object) {
|
||||
ECL_STACK_PUSH(the_env, object);
|
||||
}
|
||||
}
|
||||
args = ECL_CONS_CDR(args);
|
||||
ecl_foreign_data_set_elt(the_env->ffi_values + n, type, object);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue