summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Low <joel@joelsplace.sg>2014-12-01 09:08:30 +0800
committerJoel Low <joel@joelsplace.sg>2014-12-01 09:08:30 +0800
commit30808b769e4f0656092b7b3185c2f4149211d6eb (patch)
tree656cda82bf36d4e13fc807bba5543003d887d3d7
parent9dbe4dbe9fbaa2da26f085deb27f2b2d8e2583a8 (diff)
downloadffi-30808b769e4f0656092b7b3185c2f4149211d6eb.tar.gz
Fix compatibility with MSVC's C89 support.
-rw-r--r--ext/ffi_c/MethodHandle.c13
-rw-r--r--ext/ffi_c/StructLayout.c4
2 files changed, 8 insertions, 9 deletions
diff --git a/ext/ffi_c/MethodHandle.c b/ext/ffi_c/MethodHandle.c
index cee1df5..b60f9cc 100644
--- a/ext/ffi_c/MethodHandle.c
+++ b/ext/ffi_c/MethodHandle.c
@@ -132,12 +132,6 @@ rbffi_MethodHandle_CodeAddress(MethodHandle* handle)
#ifndef CUSTOM_TRAMPOLINE
static void attached_method_invoke(ffi_cif* cif, void* retval, METHOD_PARAMS parameters, void* user_data);
-static ffi_type* methodHandleParamTypes[] = {
- &ffi_type_sint,
- &ffi_type_pointer,
- &ffi_type_ulong,
-};
-
static ffi_cif mh_cif;
static bool
@@ -339,7 +333,12 @@ void
rbffi_MethodHandle_Init(VALUE module)
{
#ifndef CUSTOM_TRAMPOLINE
- ffi_status ffiStatus;
+ ffi_status ffiStatus;
+ ffi_type* methodHandleParamTypes[] = {
+ &ffi_type_sint,
+ &ffi_type_pointer,
+ &ffi_type_ulong,
+ };
#endif
defaultClosurePool = rbffi_ClosurePool_New((int) trampoline_size(), prep_trampoline, NULL);
diff --git a/ext/ffi_c/StructLayout.c b/ext/ffi_c/StructLayout.c
index 8edc41e..483e532 100644
--- a/ext/ffi_c/StructLayout.c
+++ b/ext/ffi_c/StructLayout.c
@@ -510,8 +510,8 @@ struct_layout_initialize(VALUE self, VALUE fields, VALUE size, VALUE align)
static VALUE
struct_layout_union_bang(VALUE self)
{
- static const ffi_type *alignment_types[] = { &ffi_type_sint8, &ffi_type_sint16, &ffi_type_sint32, &ffi_type_sint64,
- &ffi_type_float, &ffi_type_double, &ffi_type_longdouble, NULL };
+ const ffi_type *alignment_types[] = { &ffi_type_sint8, &ffi_type_sint16, &ffi_type_sint32, &ffi_type_sint64,
+ &ffi_type_float, &ffi_type_double, &ffi_type_longdouble, NULL };
StructLayout* layout;
ffi_type *t = NULL;
int count, i;