From ccd485955d0623031afd463c0145ec97cca243f9 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 6 May 2017 08:28:21 -0700 Subject: ffi: remove unchanging param from make_ffi_pointer. * ffi.c (make_ffi_type_pointer): The underlying ffi type is always ffi_type_pointer, so the parameter for specifying it is removed, and it is hard-coded. (ffi_type_compile): Remove &ffi_type_pointer argument from a half dozen calls. --- ffi.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/ffi.c b/ffi.c index d99e5beb..8052f8dc 100644 --- a/ffi.c +++ b/ffi.c @@ -1126,8 +1126,7 @@ static val make_ffi_type_builtin(val syntax, val lisp_type, return obj; } -static val make_ffi_type_pointer(val syntax, val lisp_type, - cnum size, ffi_type *ft, +static val make_ffi_type_pointer(val syntax, val lisp_type, cnum size, void (*put)(struct txr_ffi_type *, val obj, mem_t *dst, val self), val (*get)(struct txr_ffi_type *, @@ -1143,7 +1142,7 @@ static val make_ffi_type_pointer(val syntax, val lisp_type, val obj = cobj(coerce(mem_t *, tft), ffi_type_s, &ffi_type_ptr_ops); - tft->ft = ft; + tft->ft = &ffi_type_pointer; tft->syntax = syntax; tft->lt = lisp_type; tft->mnames = tft->mtypes = nil; @@ -1336,42 +1335,36 @@ val ffi_type_compile(val syntax) } else if (sym == ptr_in_s) { val target_type = ffi_type_compile(cadr(syntax)); return make_ffi_type_pointer(syntax, cptr_s, sizeof (mem_t *), - &ffi_type_pointer, ffi_ptr_in_put, ffi_ptr_get, ffi_ptr_in_in, ffi_ptr_in_out, target_type); } else if (sym == ptr_in_d_s) { val target_type = ffi_type_compile(cadr(syntax)); return make_ffi_type_pointer(syntax, cptr_s, sizeof (mem_t *), - &ffi_type_pointer, ffi_ptr_in_put, ffi_ptr_d_get, 0, ffi_ptr_in_out, target_type); } else if (sym == ptr_out_s) { val target_type = ffi_type_compile(cadr(syntax)); return make_ffi_type_pointer(syntax, cptr_s, sizeof (mem_t *), - &ffi_type_pointer, ffi_ptr_out_put, ffi_ptr_get, ffi_ptr_out_in, ffi_ptr_out_out, target_type); } else if (sym == ptr_out_d_s) { val target_type = ffi_type_compile(cadr(syntax)); return make_ffi_type_pointer(syntax, cptr_s, sizeof (mem_t *), - &ffi_type_pointer, ffi_ptr_out_null_put, ffi_ptr_d_get, ffi_ptr_out_in, ffi_ptr_out_out, target_type); } else if (sym == ptr_s) { val target_type = ffi_type_compile(cadr(syntax)); return make_ffi_type_pointer(syntax, cptr_s, sizeof (mem_t *), - &ffi_type_pointer, ffi_ptr_in_put, ffi_ptr_get, ffi_ptr_out_in, ffi_ptr_out_out, target_type); } else if (sym == ptr_out_s_s) { val target_type = ffi_type_compile(cadr(syntax)); return make_ffi_type_pointer(syntax, cptr_s, sizeof (mem_t *), - &ffi_type_pointer, ffi_ptr_out_null_put, ffi_ptr_get, ffi_ptr_out_s_in, ffi_ptr_out_out, target_type); -- cgit v1.2.3