summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-05-16 06:20:38 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-05-16 06:20:38 -0700
commitabc64add6a46971c3ccf422b1daae01f82f98d25 (patch)
tree3ea12d04ef3d4c1ba688af833e9e04482b56c02e
parentfe8f3d772630e44552adecb3d3d52a6532e88e39 (diff)
downloadtxr-abc64add6a46971c3ccf422b1daae01f82f98d25.tar.gz
txr-abc64add6a46971c3ccf422b1daae01f82f98d25.tar.bz2
txr-abc64add6a46971c3ccf422b1daae01f82f98d25.zip
ffi: tagged cptr type, for improved safety.
-rw-r--r--ffi.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ffi.c b/ffi.c
index be08e597..c588c659 100644
--- a/ffi.c
+++ b/ffi.c
@@ -1588,6 +1588,14 @@ val ffi_type_compile(val syntax)
tft->in = if3(sym == buf_s, ffi_buf_in, ffi_buf_d_in);
tft->nelem = nelem;
return type;
+ } else if (sym == cptr_s) {
+ val tag = cadr(syntax);
+ val type = make_ffi_type_builtin(syntax, cptr_s, sizeof (mem_t *),
+ &ffi_type_pointer,
+ ffi_cptr_put, ffi_cptr_get);
+ struct txr_ffi_type *tft = ffi_type_struct(type);
+ tft->mtypes = tag;
+ return type;
}
uw_throwf(error_s, lit("~a: unrecognized type operator: ~s"),