summaryrefslogtreecommitdiff
path: root/libffi/testsuite/libffi.call/problem1.c
diff options
context:
space:
mode:
Diffstat (limited to 'libffi/testsuite/libffi.call/problem1.c')
-rw-r--r--libffi/testsuite/libffi.call/problem1.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/libffi/testsuite/libffi.call/problem1.c b/libffi/testsuite/libffi.call/problem1.c
index ca70cc8d773..6a91555a1fa 100644
--- a/libffi/testsuite/libffi.call/problem1.c
+++ b/libffi/testsuite/libffi.call/problem1.c
@@ -45,19 +45,11 @@ int main(void)
ffi_type* my_ffi_struct_fields[4];
ffi_type my_ffi_struct_type;
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[4];
ffi_type* arg_types[3];
-#ifdef USING_MMAP
- pcl = allocate_mmap (sizeof(ffi_closure));
-#else
- pcl = &cl;
-#endif
-
struct my_ffi_struct g = { 1.0, 2.0, 3.0 };
struct my_ffi_struct f = { 1.0, 2.0, 3.0 };
struct my_ffi_struct res;
@@ -87,9 +79,9 @@ int main(void)
printf("res: %g %g %g\n", res.a, res.b, res.c);
/* { dg-output "\nres: 2 4 6" } */
- CHECK(ffi_prep_closure(pcl, &cif, stub, NULL) == FFI_OK);
+ CHECK(ffi_prep_closure_loc(pcl, &cif, stub, NULL, code) == FFI_OK);
- res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(pcl))(g, f);
+ res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(code))(g, f);
/* { dg-output "\n1 2 3 1 2 3: 2 4 6" } */
printf("res: %g %g %g\n", res.a, res.b, res.c);
/* { dg-output "\nres: 2 4 6" } */