]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-29565: Fix compilation for C89 (GH-8626)
authorVictor Stinner <vstinner@redhat.com>
Thu, 2 Aug 2018 15:40:11 +0000 (17:40 +0200)
committerGitHub <noreply@github.com>
Thu, 2 Aug 2018 15:40:11 +0000 (17:40 +0200)
Use a local scope for the 'i' variable.

Modules/_ctypes/libffi_msvc/ffi.c

index 75dada56133d0360c7740bcf00b40af0fb53ec85..f28c3e0a385984ea150f59a327d261b0a415b69d 100644 (file)
@@ -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@*/