summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2013-08-01 11:19:29 +0200
committerArmin Rigo <arigo@tunes.org>2013-08-01 11:19:29 +0200
commitbdd47f79eaf4550cb066b434f3ca11255b10aae8 (patch)
tree153b559cfb603500f73d808219ac6627f6b848f3
parent0d9b31d93c4e40f13f84cd5a61feec724842ce14 (diff)
downloadcffi-bdd47f79eaf4550cb066b434f3ca11255b10aae8.tar.gz
I fail to see how "cif->bytes ? cif->bytes : 40" means "at least 40".
It seems to mean only "not 0" to me.
-rw-r--r--c/libffi_msvc/ffi.c3
-rw-r--r--c/libffi_msvc/prep_cif.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/c/libffi_msvc/ffi.c b/c/libffi_msvc/ffi.c
index 4296326..4f9a053 100644
--- a/c/libffi_msvc/ffi.c
+++ b/c/libffi_msvc/ffi.c
@@ -221,8 +221,7 @@ ffi_call(/*@dependent@*/ ffi_cif *cif,
#else
case FFI_SYSV:
/*@-usedef@*/
- /* Function call needs at least 40 bytes stack size, on win64 AMD64 */
- return ffi_call_AMD64(ffi_prep_args, &ecif, cif->bytes ? cif->bytes : 40,
+ return ffi_call_AMD64(ffi_prep_args, &ecif, cif->bytes,
cif->flags, ecif.rvalue, fn);
/*@=usedef@*/
break;
diff --git a/c/libffi_msvc/prep_cif.c b/c/libffi_msvc/prep_cif.c
index ebe24f8..5dacfff 100644
--- a/c/libffi_msvc/prep_cif.c
+++ b/c/libffi_msvc/prep_cif.c
@@ -168,6 +168,12 @@ ffi_status ffi_prep_cif(/*@out@*/ /*@partial@*/ ffi_cif *cif,
#endif
}
+#ifdef _WIN64
+ /* Function call needs at least 40 bytes stack size, on win64 AMD64 */
+ if (bytes < 40)
+ bytes = 40;
+#endif
+
cif->bytes = bytes;
/* Perform machine dependent cif processing */