diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-04-27 23:02:38 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-04-27 23:02:38 -0700 |
commit | cd1a4d462c52de2f15c5f3f5bd6fb760b6e29420 (patch) | |
tree | eaf8f8ab29cadec0a8014bbc8d92c7fa3d315b09 | |
parent | c489ea71dd23c4108bad92bba463cd153fc9135c (diff) | |
download | txr-cd1a4d462c52de2f15c5f3f5bd6fb760b6e29420.tar.gz txr-cd1a4d462c52de2f15c5f3f5bd6fb760b6e29420.tar.bz2 txr-cd1a4d462c52de2f15c5f3f5bd6fb760b6e29420.zip |
ffi: fix problems caught by g++.
* ffi.c (float_s): Variable removed. This is a duplicate
definition; we already have this symbol in lib.c.
(ffi_type_s): Duplicate definition removed; it is
repeated two lines below.
(ffi_str_put): Remove pointless const qualifier on u8s
variable.
(ffi_call_wrap): Cast return value of alloca. Also,
rc pointer needs to be cast to mem_t *.
(ffi_init): Remove initialization of float_s.
* ffi.h (float_s): Declaration removed.
-rw-r--r-- | ffi.c | 11 | ||||
-rw-r--r-- | ffi.h | 2 |
2 files changed, 5 insertions, 8 deletions
@@ -62,7 +62,7 @@ val short_s, ushort_s; val int_s, uint_s; val long_s, ulong_s; -val float_s, double_s; +val double_s; val array_s; @@ -74,8 +74,6 @@ val wstr_s; val ptr_in_s, ptr_out_s, ptr_in_out_s; -val ffi_type_s; - val ffi_type_s, ffi_call_desc_s; struct txr_ffi_type { @@ -575,7 +573,7 @@ static void ffi_str_put(struct txr_ffi_type *tft, val s, mem_t *dst, val self) { const wchar_t *ws = c_str(s); - const char *u8s = utf8_dup_to(ws); + char *u8s = utf8_dup_to(ws); free(tft->buf); tft->buf = coerce(mem_t *, u8s); tft->in = ffi_freeing_in; @@ -1242,7 +1240,7 @@ val ffi_call_wrap(val ffi_call_desc, val fptr, val args_in) struct txr_ffi_call_desc *tfcd = ffi_call_desc_checked(ffi_call_desc); mem_t *fp = cptr_get(fptr); cnum n = tfcd->ntotal, i; - void **values = alloca(sizeof *values * tfcd->ntotal); + void **values = convert(void **, alloca(sizeof *values * tfcd->ntotal)); val args = args_in; val types = tfcd->argtypes; val rtype = tfcd->rettype; @@ -1273,7 +1271,7 @@ val ffi_call_wrap(val ffi_call_desc, val fptr, val args_in) } } - return rtft->get(rtft, rc, self); + return rtft->get(rtft, convert(mem_t *, rc), self); } void ffi_init(void) @@ -1295,7 +1293,6 @@ void ffi_init(void) uint_s = intern(lit("uint"), user_package); long_s = intern(lit("long"), user_package); ulong_s = intern(lit("ulong"), user_package); - float_s = intern(lit("float"), user_package); double_s = intern(lit("double"), user_package); array_s = intern(lit("array"), user_package); void_s = intern(lit("void"), user_package); @@ -35,7 +35,7 @@ extern val short_s, ushort_s; extern val int_s, uint_s; extern val long_s, ulong_s; -extern val float_s, double_s; +extern val double_s; extern val wstr_s; |