1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00

handleKeyPress: Fix shadowing of global 'index' variable

GCC warns:

event.c: In function 'handleDestroyNotify':
event.c:676: warning: declaration of 'index' shadows a global declaration
/usr/include/string.h:309: warning: shadowed declaration is here
event.c: In function 'handleKeyPress':
event.c:1435: warning: declaration of 'index' shadows a global declaration
/usr/include/string.h:309: warning: shadowed declaration is here

So let's rename "index" to "widx".

Note that there is a more serious shadowing in this same function,

event.c:1686: warning: declaration of 'wwin' shadows a previous local

but this is more complicated to solve.
This commit is contained in:
Carlos R. Mafra
2009-08-18 00:56:09 +02:00
parent f18567db9a
commit 9baff1363c

View File

@@ -673,7 +673,7 @@ handleDestroyNotify(XEvent *event)
WApplication *app; WApplication *app;
Window window = event->xdestroywindow.window; Window window = event->xdestroywindow.window;
WScreen *scr = wScreenForRootWindow(event->xdestroywindow.event); WScreen *scr = wScreenForRootWindow(event->xdestroywindow.event);
int index; int widx;
#ifdef DEBUG #ifdef DEBUG
printf("got destroy notify\n"); printf("got destroy notify\n");
@@ -684,11 +684,11 @@ handleDestroyNotify(XEvent *event)
} }
if (scr != NULL) { if (scr != NULL) {
while ((index = WMFindInArray(scr->fakeGroupLeaders, matchWindow, while ((widx = WMFindInArray(scr->fakeGroupLeaders, matchWindow,
(void*)window)) != WANotFound) { (void*)window)) != WANotFound) {
WFakeGroupLeader *fPtr; WFakeGroupLeader *fPtr;
fPtr = WMGetFromArray(scr->fakeGroupLeaders, index); fPtr = WMGetFromArray(scr->fakeGroupLeaders, widx);
if (fPtr->retainCount > 0) { if (fPtr->retainCount > 0) {
fPtr->retainCount--; fPtr->retainCount--;
if (fPtr->retainCount==0 && fPtr->leader!=None) { if (fPtr->retainCount==0 && fPtr->leader!=None) {
@@ -1432,7 +1432,7 @@ handleKeyPress(XEvent *event)
WWindow *wwin = scr->focused_window; WWindow *wwin = scr->focused_window;
int i; int i;
int modifiers; int modifiers;
int command=-1, index; int command=-1, widx;
#ifdef KEEP_XKB_LOCK_STATUS #ifdef KEEP_XKB_LOCK_STATUS
XkbStateRec staterec; XkbStateRec staterec;
#endif /*KEEP_XKB_LOCK_STATUS*/ #endif /*KEEP_XKB_LOCK_STATUS*/
@@ -1675,10 +1675,10 @@ handleKeyPress(XEvent *event)
case WKBD_WINDOW9: case WKBD_WINDOW9:
case WKBD_WINDOW10: case WKBD_WINDOW10:
index = command-WKBD_WINDOW1; widx = command-WKBD_WINDOW1;
if (scr->shortcutWindows[index]) { if (scr->shortcutWindows[widx]) {
WMArray *list = scr->shortcutWindows[index]; WMArray *list = scr->shortcutWindows[widx];
int cw; int cw;
int count = WMGetArrayItemCount(list); int count = WMGetArrayItemCount(list);
WWindow *twin; WWindow *twin;
@@ -1704,19 +1704,19 @@ handleKeyPress(XEvent *event)
WMAddToArray(list, twin); WMAddToArray(list, twin);
} else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) { } else if (wwin && ISMAPPED(wwin) && ISFOCUSED(wwin)) {
if (scr->shortcutWindows[index]) { if (scr->shortcutWindows[widx]) {
WMFreeArray(scr->shortcutWindows[index]); WMFreeArray(scr->shortcutWindows[widx]);
scr->shortcutWindows[index] = NULL; scr->shortcutWindows[widx] = NULL;
} }
if (wwin->flags.selected && scr->selected_windows) { if (wwin->flags.selected && scr->selected_windows) {
scr->shortcutWindows[index] = scr->shortcutWindows[widx] =
WMDuplicateArray(scr->selected_windows); WMDuplicateArray(scr->selected_windows);
/*WMRemoveFromArray(scr->shortcutWindows[index], wwin); /*WMRemoveFromArray(scr->shortcutWindows[index], wwin);
WMInsertInArray(scr->shortcutWindows[index], 0, wwin);*/ WMInsertInArray(scr->shortcutWindows[index], 0, wwin);*/
} else { } else {
scr->shortcutWindows[index] = WMCreateArray(4); scr->shortcutWindows[widx] = WMCreateArray(4);
WMAddToArray(scr->shortcutWindows[index], wwin); WMAddToArray(scr->shortcutWindows[widx], wwin);
} }
wSelectWindow(wwin, !wwin->flags.selected); wSelectWindow(wwin, !wwin->flags.selected);
@@ -1729,10 +1729,10 @@ handleKeyPress(XEvent *event)
&& WMGetArrayItemCount(scr->selected_windows)) { && WMGetArrayItemCount(scr->selected_windows)) {
if (wwin->flags.selected && scr->selected_windows) { if (wwin->flags.selected && scr->selected_windows) {
if (scr->shortcutWindows[index]) { if (scr->shortcutWindows[widx]) {
WMFreeArray(scr->shortcutWindows[index]); WMFreeArray(scr->shortcutWindows[widx]);
} }
scr->shortcutWindows[index] = scr->shortcutWindows[widx] =
WMDuplicateArray(scr->selected_windows); WMDuplicateArray(scr->selected_windows);
} }
} }