diff options
Diffstat (limited to 'ext/ffi_c/libffi/testsuite/libffi.call/struct1.c')
-rw-r--r-- | ext/ffi_c/libffi/testsuite/libffi.call/struct1.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c b/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c index ea76c85..c13e23f 100644 --- a/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c +++ b/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c @@ -14,7 +14,7 @@ typedef struct unsigned int ui; } test_structure_1; -static test_structure_1 struct1(test_structure_1 ts) +static test_structure_1 ABI_ATTR struct1(test_structure_1 ts) { ts.uc++; ts.d--; @@ -30,6 +30,13 @@ int main (void) void *values[MAX_ARGS]; ffi_type ts1_type; ffi_type *ts1_type_elements[4]; + + test_structure_1 ts1_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_1 *ts1_result = + (test_structure_1 *) malloc (sizeof(test_structure_1)); + ts1_type.size = 0; ts1_type.alignment = 0; ts1_type.type = FFI_TYPE_STRUCT; @@ -39,16 +46,11 @@ int main (void) ts1_type_elements[2] = &ffi_type_uint; ts1_type_elements[3] = NULL; - test_structure_1 ts1_arg; - /* This is a hack to get a properly aligned result buffer */ - test_structure_1 *ts1_result = - (test_structure_1 *) malloc (sizeof(test_structure_1)); - args[0] = &ts1_type; values[0] = &ts1_arg; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts1_type, args) == FFI_OK); ts1_arg.uc = '\x01'; |