* 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
This commit is contained in:
nobu 2010-10-30 00:08:30 +00:00
parent 4e11a8997d
commit 6b48289bb7
2 changed files with 8 additions and 5 deletions

View File

@ -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.

View File

@ -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,