diff options
author | Ludovic Courtès <ludo@gnu.org> | 2010-04-09 00:14:34 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2010-04-09 00:32:14 +0200 |
commit | 4551e860f02244ffb3858c941319f1613bac40e4 (patch) | |
tree | 9815b96f09ff0096812e8e1deb7f2033d9ab732f | |
parent | b577bc90bbaadfac508acc809e59b983db33b7aa (diff) | |
download | guile-4551e860f02244ffb3858c941319f1613bac40e4.tar.gz |
Allocate foreign pointer objects in GC-scanned memory.
* libguile/foreign.c (scm_take_foreign_pointer): Allocate RET in
GC-scanned memory. This fixes a bug where the object pointed to by
SCM_CIF in the pair returned by `cif_to_procedure ()' would be
reclaimed (as a consequence of commit
087aa6aa312a8d0af51fa9b2f7bfc1332ad97338).
-rw-r--r-- | libguile/foreign.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/libguile/foreign.c b/libguile/foreign.c index 3281744ad..0d6b67000 100644 --- a/libguile/foreign.c +++ b/libguile/foreign.c @@ -89,12 +89,8 @@ scm_take_foreign_pointer (scm_t_foreign_type type, void *ptr, size_t len, | (finalizer ? (1<<16) : 0) | (len<<17)); if (SCM_UNLIKELY ((word0 >> 17) != len)) scm_out_of_range ("scm_take_foreign_pointer", scm_from_size_t (len)); - - ret = PTR2SCM (scm_gc_malloc_pointerless (sizeof (scm_t_bits) * 2, - "foreign")); - SCM_SET_CELL_WORD_0 (ret, word0); - SCM_SET_CELL_WORD_1 (ret, (scm_t_bits)ptr); + ret = scm_cell (word0, (scm_t_bits) ptr); if (finalizer) { /* Register a finalizer for the newly created instance. */ |