diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-04-29 06:51:55 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-04-29 06:51:55 -0700 |
commit | 47a170b8c143143d0eb2a0b778c583b3a370c587 (patch) | |
tree | e255ff981e6e0262aa77ce09d69c3465f04b5278 /buf.c | |
parent | d2ae9d8070d38221ee323b6679152bbbc4d7acd7 (diff) | |
download | txr-47a170b8c143143d0eb2a0b778c583b3a370c587.tar.gz txr-47a170b8c143143d0eb2a0b778c583b3a370c587.tar.bz2 txr-47a170b8c143143d0eb2a0b778c583b3a370c587.zip |
ffi: correct treatment of (ptr buf).
The buf FFI type's alloc virtual should return a pointer to
the buffer's pointer, not the buffer itself.
What's currently going on is something silly, whereby
the pointer to the buffer is stored into the buffer
itself.
* buf.c (buf_addr_of): New function.
* buf.c (buf_addr_of): Declared.
* ffi.c (ffi_buf_alloc): Use buf_addr_of instead of buf_get.
Diffstat (limited to 'buf.c')
-rw-r--r-- | buf.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -204,6 +204,12 @@ mem_t *buf_get(val buf, val self) return b->data; } +mem_t **buf_addr_of(val buf, val self) +{ + struct buf *b = buf_handle(buf, self); + return &b->data; +} + void buf_fill(val buf, mem_t *src, val self) { struct buf *b = buf_handle(buf, self); |