diff options
author | Wayne Meissner <wmeissner@gmail.com> | 2009-03-15 14:26:16 +1000 |
---|---|---|
committer | Wayne Meissner <wmeissner@gmail.com> | 2009-03-15 14:26:16 +1000 |
commit | 5ff7341edc0315af8b87664e2b3cab2014dce64c (patch) | |
tree | 17a3550a4cb4b077ac66bb2dea55cbf14a1ff170 /ext/ffi_c/AbstractMemory.h | |
parent | 812412bd34468d64e58f5aab60d1dc13aabdf68f (diff) | |
download | ffi-5ff7341edc0315af8b87664e2b3cab2014dce64c.tar.gz |
Convert froml (AbstractMemory *) DATA_PTR(obj) to calls to rb_FFI_AbstractMemory_cast(obj, klass) to ensure an exception is raised for invalid objects
Diffstat (limited to 'ext/ffi_c/AbstractMemory.h')
-rw-r--r-- | ext/ffi_c/AbstractMemory.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/ffi_c/AbstractMemory.h b/ext/ffi_c/AbstractMemory.h index 2df3816..729f9cf 100644 --- a/ext/ffi_c/AbstractMemory.h +++ b/ext/ffi_c/AbstractMemory.h @@ -23,6 +23,12 @@ checkBounds(AbstractMemory* mem, long off, long len) } } +#define MEMORY(obj) rb_FFI_AbstractMemory_cast((obj), rb_FFI_AbstractMemory_class) +#define MEMORY_PTR(obj) MEMORY((obj))->address +#define MEMORY_LEN(obj) MEMORY((obj))->size + +extern AbstractMemory* rb_FFI_AbstractMemory_cast(VALUE obj, VALUE klass); + extern VALUE rb_FFI_AbstractMemory_class; #ifdef __cplusplus } |