diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-24 01:59:38 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-06-24 01:59:38 +0000 |
commit | 55f1a19451e5fab7e1085a7ae29dfdb96ef3f775 (patch) | |
tree | 1f0fdd357c9fd02bcd0e1723bf18a5e0b568da14 /ext | |
parent | fac216efa02e2e35e58d63ab5c8f9040ff3bf514 (diff) |
merges r28315 from trunk into ruby_1_9_2.
--
* ext/fiddle/closure.c (dealloc): refix workaround r28300.
don't use ffi_closure_alloc, ffi_prep_closure_loc and
ffi_closure_free on MACOSX and __linux__.
[ruby-dev:41483] [ruby-dev:41214]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/fiddle/closure.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c index 3dc8eda013..072e13e748 100644 --- a/ext/fiddle/closure.c +++ b/ext/fiddle/closure.c @@ -10,19 +10,19 @@ typedef struct { ffi_type **argv; } fiddle_closure; +#if defined(MACOSX) || defined(__linux) +#define DONT_USE_FFI_CLOSURE_ALLOC +#endif + static void dealloc(void * ptr) { fiddle_closure * cls = (fiddle_closure *)ptr; - /* -#ifndef MACOSX +#ifndef DONT_USE_FFI_CLOSURE_ALLOC ffi_closure_free(cls->pcl); #else - */ munmap(cls->pcl, sizeof(cls->pcl)); - /* #endif - */ xfree(cls->cif); if (cls->argv) xfree(cls->argv); xfree(cls); @@ -142,7 +142,7 @@ allocate(VALUE klass) VALUE i = TypedData_Make_Struct(klass, fiddle_closure, &closure_data_type, closure); -#ifndef MACOSX +#ifndef DONT_USE_FFI_CLOSURE_ALLOC closure->pcl = ffi_closure_alloc(sizeof(ffi_closure), &closure->code); #else closure->pcl = mmap(NULL, sizeof(ffi_closure), PROT_READ | PROT_WRITE, @@ -195,7 +195,7 @@ initialize(int rbargc, VALUE argv[], VALUE self) if (FFI_OK != result) rb_raise(rb_eRuntimeError, "error prepping CIF %d", result); -#ifndef MACOSX +#ifndef DONT_USE_FFI_CLOSURE_ALLOC result = ffi_prep_closure_loc(pcl, cif, callback, (void *)self, cl->code); #else |