Skip to content

Commit b8bbaae

Browse files
mithrosbourdeauducq
authored andcommittedApr 20, 2015
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 #14
1 parent f57ee29 commit b8bbaae

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

Diff for: ‎vpi/ipc.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -95,29 +95,29 @@ int ipc_receive(struct ipc_softc *sc)
9595
char *name;
9696
int nchunks;
9797
unsigned char *chunks;
98-
unsigned int index;
98+
unsigned int chunk_index;
9999

100100
name = (char *)&buffer[i];
101101
i += strlen(name) + 1;
102102
assert((i+4) < l);
103-
index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24;
103+
chunk_index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24;
104104
i += 4;
105105
nchunks = buffer[i++];
106106
assert(i + nchunks == l);
107107
chunks = (unsigned char *)&buffer[i];
108108

109-
return sc->h_write(name, index, nchunks, chunks, sc->user);
109+
return sc->h_write(name, chunk_index, nchunks, chunks, sc->user);
110110
}
111111
case MESSAGE_READ: {
112112
char *name;
113-
unsigned int index;
113+
unsigned int name_index;
114114

115115
name = (char *)&buffer[i];
116116
i += strlen(name) + 1;
117117
assert((i+4) == l);
118-
index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24;
118+
name_index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24;
119119

120-
return sc->h_read(name, index, sc->user);
120+
return sc->h_read(name, name_index, sc->user);
121121
}
122122
default:
123123
return 0;

0 commit comments

Comments
 (0)
Please sign in to comment.