Skip to content

Commit 6a6b248

Browse files
authored
bpo-29565: Fix compilation for C89 (GH-8626)
Use a local scope for the 'i' variable.
1 parent 3243f8c commit 6a6b248

File tree

1 file changed

+12
-8
lines changed
  • Modules/_ctypes/libffi_msvc

1 file changed

+12
-8
lines changed

Modules/_ctypes/libffi_msvc/ffi.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,18 @@ ffi_call(/*@dependent@*/ ffi_cif *cif,
220220
break;
221221
#else
222222
case FFI_SYSV:
223-
/* If a single argument takes more than 8 bytes,
224-
then a copy is passed by reference. */
225-
for (unsigned i = 0; i < cif->nargs; i++) {
226-
size_t z = cif->arg_types[i]->size;
227-
if (z > 8) {
228-
void *temp = alloca(z);
229-
memcpy(temp, avalue[i], z);
230-
avalue[i] = temp;
223+
/* use a local scope for the 'i' variable */
224+
{
225+
unsigned i;
226+
/* If a single argument takes more than 8 bytes,
227+
then a copy is passed by reference. */
228+
for (i = 0; i < cif->nargs; i++) {
229+
size_t z = cif->arg_types[i]->size;
230+
if (z > 8) {
231+
void *temp = alloca(z);
232+
memcpy(temp, avalue[i], z);
233+
avalue[i] = temp;
234+
}
231235
}
232236
}
233237
/*@-usedef@*/

0 commit comments

Comments
 (0)