diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-08-02 17:40:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-02 17:40:11 +0200 |
commit | 6a6b2483479a1ad0ab82300452f0ce71fa90b2d7 (patch) | |
tree | d3e534161d4d0aa0beae548ce439679158986e88 /Modules | |
parent | 3243f8c1fb16b6de73f1d7a30f5d09047553bce3 (diff) | |
download | cpython-git-6a6b2483479a1ad0ab82300452f0ce71fa90b2d7.tar.gz |
bpo-29565: Fix compilation for C89 (GH-8626)
Use a local scope for the 'i' variable.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ctypes/libffi_msvc/ffi.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Modules/_ctypes/libffi_msvc/ffi.c b/Modules/_ctypes/libffi_msvc/ffi.c index 75dada5613..f28c3e0a38 100644 --- a/Modules/_ctypes/libffi_msvc/ffi.c +++ b/Modules/_ctypes/libffi_msvc/ffi.c @@ -220,14 +220,18 @@ ffi_call(/*@dependent@*/ ffi_cif *cif, break; #else case FFI_SYSV: - /* If a single argument takes more than 8 bytes, - then a copy is passed by reference. */ - for (unsigned i = 0; i < cif->nargs; i++) { - size_t z = cif->arg_types[i]->size; - if (z > 8) { - void *temp = alloca(z); - memcpy(temp, avalue[i], z); - avalue[i] = temp; + /* use a local scope for the 'i' variable */ + { + unsigned i; + /* If a single argument takes more than 8 bytes, + then a copy is passed by reference. */ + for (i = 0; i < cif->nargs; i++) { + size_t z = cif->arg_types[i]->size; + if (z > 8) { + void *temp = alloca(z); + memcpy(temp, avalue[i], z); + avalue[i] = temp; + } } } /*@-usedef@*/ |