Fixing shadowing of global index function.
authorTim 'mithro' Ansell <mithro@mithis.com>
Sun, 19 Apr 2015 06:54:57 +0000 (16:54 +1000)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Mon, 20 Apr 2015 16:26:07 +0000 (00:26 +0800)
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

vpi/ipc.c

index ee1920e5edfa03fec0c696bba17d20d1aabcedf6..8b1357c712bc025ed579c5da57a3fa6d0607ceb7 100644 (file)
--- a/vpi/ipc.c
+++ b/vpi/ipc.c
@@ -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;