From 8a20c4af0ae40dd28fb351a49e14892070c1eae1 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku <kaz@kylheku.com> Date: Sat, 29 Apr 2017 09:41:24 -0700 Subject: ffi: rename ptr-in-out to just ptr. Why have this verbose naming for the most basic case. Rather, ptr-in and ptr-out are optimizations of ptr which just avoid copying the object in one direction. * ffi.c (ptr_in_out_s): Renamed to ptr_s. (ffi_ptr_in_out_put): Renamed to ffi_ptr_put. (ffi_type_compile, ffi_init): Follow rename. * ffi.h (ptr_in_out_s): Declaration updated --- ffi.c | 12 ++++++------ ffi.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ffi.c b/ffi.c index 7af6dda7..3159d2d0 100644 --- a/ffi.c +++ b/ffi.c @@ -74,7 +74,7 @@ val str_d_s, wstr_s, wstr_d_s; val buf_d_s; -val ptr_in_s, ptr_out_s, ptr_in_out_s; +val ptr_in_s, ptr_out_s, ptr_s; val ffi_type_s, ffi_call_desc_s; @@ -750,8 +750,8 @@ static val ffi_ptr_out_get(struct txr_ffi_type *tft, mem_t *src, val self) return tgtft->get(tgtft, ptr, self); } -static void ffi_ptr_in_out_put(struct txr_ffi_type *tft, val s, mem_t *dst, - mem_t *rtvec[], val self) +static void ffi_ptr_put(struct txr_ffi_type *tft, val s, mem_t *dst, + mem_t *rtvec[], val self) { val tgttype = tft->mtypes; struct txr_ffi_type *tgtft = ffi_type_struct(tgttype); @@ -1153,11 +1153,11 @@ val ffi_type_compile(val syntax) &ffi_type_pointer, ffi_ptr_out_put, ffi_ptr_out_get, ffi_ptr_out_in, target_type); - } else if (sym == ptr_in_out_s) { + } 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_out_put, ffi_ptr_out_get, + ffi_ptr_put, ffi_ptr_out_get, ffi_ptr_out_in, target_type); } else if (sym == buf_s || sym == buf_d_s) { cnum nelem = c_num(cadr(syntax)); @@ -1491,7 +1491,7 @@ void ffi_init(void) buf_d_s = intern(lit("buf-d"), user_package); ptr_in_s = intern(lit("ptr-in"), user_package); ptr_out_s = intern(lit("ptr-out"), user_package); - ptr_in_out_s = intern(lit("ptr-in-out"), user_package); + ptr_s = intern(lit("ptr"), user_package); ffi_type_s = intern(lit("ffi-type"), user_package); ffi_call_desc_s = intern(lit("ffi-call-desc"), user_package); reg_fun(intern(lit("ffi-type-compile"), user_package), func_n1(ffi_type_compile_toplevel)); diff --git a/ffi.h b/ffi.h index 99c87a28..27e9bc10 100644 --- a/ffi.h +++ b/ffi.h @@ -41,7 +41,7 @@ extern val str_d_s, wstr_s, wstr_d_s; extern val buf_d_s; -extern val ptr_in_s, ptr_out_s, ptr_in_out_s; +extern val ptr_in_s, ptr_out_s, ptr_s; extern val array_s; -- cgit v1.2.3