dmx: attempt to untangle nested loops using same index variable
This doesn't just make gcc sad, it makes my brain sad. Change from: for (i = 0; i < dmxNumScreens; i++) { int i; for (i = 0; i < nconfigs; i++) { for (j = 0; j < dmxScreen->beNumVisuals; j++) { to the easier to follow: for (i = 0; i < dmxNumScreens; i++) { for (j = 0; j < nconfigs; j++) { for (k = 0; k < dmxScreen->beNumVisuals; k++) { Gets rid of gcc 4.8 warning: dmxinit.c: In function ‘InitOutput’: dmxinit.c:765:17: warning: declaration of ‘i’ shadows a previous local [-Wshadow] int i; ^ dmxinit.c:608:9: warning: shadowed declaration is here [-Wshadow] int i; ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Rémi Cardona <remi@gentoo.org> Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
0fbebad724
commit
57e08fae82
|
@ -762,7 +762,6 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
|
|||
dmxGlxVisualPrivate **configprivs = NULL;
|
||||
int nconfigs = 0;
|
||||
int (*oldErrorHandler) (Display *, XErrorEvent *);
|
||||
int i;
|
||||
|
||||
/* Catch errors if when using an older GLX w/o FBconfigs */
|
||||
oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler);
|
||||
|
@ -797,28 +796,29 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
|
|||
configprivs = malloc(nconfigs * sizeof(dmxGlxVisualPrivate *));
|
||||
|
||||
if (configs != NULL && configprivs != NULL) {
|
||||
int j;
|
||||
|
||||
/* Initialize our private info for each visual
|
||||
* (currently only x_visual_depth and x_visual_class)
|
||||
*/
|
||||
for (i = 0; i < nconfigs; i++) {
|
||||
for (j = 0; j < nconfigs; j++) {
|
||||
|
||||
configprivs[i] = (dmxGlxVisualPrivate *)
|
||||
configprivs[j] = (dmxGlxVisualPrivate *)
|
||||
malloc(sizeof(dmxGlxVisualPrivate));
|
||||
configprivs[i]->x_visual_depth = 0;
|
||||
configprivs[i]->x_visual_class = 0;
|
||||
configprivs[j]->x_visual_depth = 0;
|
||||
configprivs[j]->x_visual_class = 0;
|
||||
|
||||
/* Find the visual depth */
|
||||
if (configs[i].vid > 0) {
|
||||
int j;
|
||||
if (configs[j].vid > 0) {
|
||||
int k;
|
||||
|
||||
for (j = 0; j < dmxScreen->beNumVisuals; j++) {
|
||||
if (dmxScreen->beVisuals[j].visualid ==
|
||||
configs[i].vid) {
|
||||
configprivs[i]->x_visual_depth =
|
||||
dmxScreen->beVisuals[j].depth;
|
||||
configprivs[i]->x_visual_class =
|
||||
dmxScreen->beVisuals[j].class;
|
||||
for (k = 0; k < dmxScreen->beNumVisuals; k++) {
|
||||
if (dmxScreen->beVisuals[k].visualid ==
|
||||
configs[j].vid) {
|
||||
configprivs[j]->x_visual_depth =
|
||||
dmxScreen->beVisuals[k].depth;
|
||||
configprivs[j]->x_visual_class =
|
||||
dmxScreen->beVisuals[k].class;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user