Fixing shadowing of global index function.

Fixes the following warnings;
```
cc -Wall -O2  -fPIC -Wall -Wshadow -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -I/usr/include/iverilog -c  -o ipc.o ipc.c
ipc.c: In function ‘ipc_receive’:
ipc.c:98:17: warning: declaration of ‘index’ shadows a global declaration [-Wshadow]
ipc.c:113:17: warning: declaration of ‘index’ shadows a global declaration [-Wshadow]
```

Fixes https://github.com/m-labs/migen/issues/14
This commit is contained in:
Tim 'mithro' Ansell 2015-04-19 16:54:57 +10:00 committed by Sebastien Bourdeauducq
parent f57ee296a9
commit b8bbaaef3a
1 changed files with 6 additions and 6 deletions

View File

@ -95,29 +95,29 @@ int ipc_receive(struct ipc_softc *sc)
char *name;
int nchunks;
unsigned char *chunks;
unsigned int index;
unsigned int chunk_index;
name = (char *)&buffer[i];
i += strlen(name) + 1;
assert((i+4) < l);
index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24;
chunk_index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24;
i += 4;
nchunks = buffer[i++];
assert(i + nchunks == l);
chunks = (unsigned char *)&buffer[i];
return sc->h_write(name, index, nchunks, chunks, sc->user);
return sc->h_write(name, chunk_index, nchunks, chunks, sc->user);
}
case MESSAGE_READ: {
char *name;
unsigned int index;
unsigned int name_index;
name = (char *)&buffer[i];
i += strlen(name) + 1;
assert((i+4) == l);
index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24;
name_index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24;
return sc->h_read(name, index, sc->user);
return sc->h_read(name, name_index, sc->user);
}
default:
return 0;