summaryrefslogtreecommitdiff
path: root/libffi/testsuite/libffi.call/nested_struct4.c
diff options
context:
space:
mode:
Diffstat (limited to 'libffi/testsuite/libffi.call/nested_struct4.c')
-rw-r--r--libffi/testsuite/libffi.call/nested_struct4.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/libffi/testsuite/libffi.call/nested_struct4.c b/libffi/testsuite/libffi.call/nested_struct4.c
index 0553ce88166..98e491e65cf 100644
--- a/libffi/testsuite/libffi.call/nested_struct4.c
+++ b/libffi/testsuite/libffi.call/nested_struct4.c
@@ -50,22 +50,14 @@ B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
int main (void)
{
ffi_cif cif;
-#ifndef USING_MMAP
- static ffi_closure cl;
-#endif
- ffi_closure *pcl;
+ void *code;
+ ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[3];
ffi_type* cls_struct_fields[3];
ffi_type* cls_struct_fields1[3];
ffi_type cls_struct_type, cls_struct_type1;
ffi_type* dbl_arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
@@ -107,9 +99,9 @@ int main (void)
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));
CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b));
- CHECK(ffi_prep_closure(pcl, &cif, B_gn, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK);
- res_dbl = ((B(*)(A, B))(pcl))(e_dbl, f_dbl);
+ res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl);
/* { dg-output "\n1 7 12 127 99: 13 233 134" } */
CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a));
CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y));