aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-30 00:08:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-30 00:08:30 +0000
commit6b48289bb737b820d2b0315baee284bcf5ce3253 (patch)
treee6dd17ccba0aaf20b8e17b9aee4218341d9acafe
parent4e11a8997decc2dfbea5daad5108d1301f287e53 (diff)
downloadruby-6b48289bb737b820d2b0315baee284bcf5ce3253.tar.gz
* ext/fiddle/closure.c (fiddle_closure): embed cif not reference
so that the content surely get initialized. [ruby-dev:42480] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ext/fiddle/closure.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index ee0d7aaa2c..87cbad0091 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Oct 30 09:08:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/fiddle/closure.c (fiddle_closure): embed cif not reference
+ so that the content surely get initialized. [ruby-dev:42480]
+
Sat Oct 30 07:01:53 2010 Tanaka Akira <akr@fsij.org>
* lib/resolv-replace.rb: suppress warning.
diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c
index 5e9ede7b2d..157b97ca46 100644
--- a/ext/fiddle/closure.c
+++ b/ext/fiddle/closure.c
@@ -5,7 +5,7 @@ VALUE cFiddleClosure;
typedef struct {
void * code;
ffi_closure *pcl;
- ffi_cif * cif;
+ ffi_cif cif;
int argc;
ffi_type **argv;
} fiddle_closure;
@@ -23,7 +23,6 @@ dealloc(void * ptr)
#else
munmap(cls->pcl, sizeof(cls->pcl));
#endif
- xfree(cls->cif);
if (cls->argv) xfree(cls->argv);
xfree(cls);
}
@@ -37,7 +36,7 @@ closure_memsize(const void * ptr)
if (ptr) {
size += sizeof(*cls);
#if !defined(FFI_NO_RAW_API) || !FFI_NO_RAW_API
- size += ffi_raw_size(cls->cif);
+ size += ffi_raw_size(&cls->cif);
#endif
size += sizeof(*cls->argv);
size += sizeof(ffi_closure);
@@ -148,7 +147,6 @@ allocate(VALUE klass)
closure->pcl = mmap(NULL, sizeof(ffi_closure), PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
#endif
- closure->cif = xmalloc(sizeof(ffi_cif));
return i;
}
@@ -185,7 +183,7 @@ initialize(int rbargc, VALUE argv[], VALUE self)
rb_iv_set(self, "@ctype", ret);
rb_iv_set(self, "@args", args);
- cif = cl->cif;
+ cif = &cl->cif;
pcl = cl->pcl;
result = ffi_prep_cif(cif, NUM2INT(abi), argc,