bpo-29565: Fix compilation for C89 (GH-8626)
![](https://secure.gravatar.com/avatar/cc7737cd64a84f1b5c61a160798e97ee.jpg?s=120&d=mm&r=g)
https://github.com/python/cpython/commit/6a6b2483479a1ad0ab82300452f0ce71fa9... commit: 6a6b2483479a1ad0ab82300452f0ce71fa90b2d7 branch: 2.7 author: Victor Stinner <vstinner@redhat.com> committer: GitHub <noreply@github.com> date: 2018-08-02T17:40:11+02:00 summary: bpo-29565: Fix compilation for C89 (GH-8626) Use a local scope for the 'i' variable. files: M Modules/_ctypes/libffi_msvc/ffi.c diff --git a/Modules/_ctypes/libffi_msvc/ffi.c b/Modules/_ctypes/libffi_msvc/ffi.c index 75dada56133d..f28c3e0a3859 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@*/
participants (1)
-
Victor Stinner