aboutsummaryrefslogtreecommitdiff
path: root/nx-X11
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2020-01-09 22:44:55 +0100
committerUlrich Sibiller <uli42@gmx.de>2020-01-10 00:25:46 +0100
commit914f88a8ab7bbbef3f0cb0674dfa5bd1fbddf050 (patch)
treecb2c97e6483a403a364c24cc000cb20074435a50 /nx-X11
parentae180b6b52640512fcf0bf6b05bba3449b409640 (diff)
downloadnx-libs-914f88a8ab7bbbef3f0cb0674dfa5bd1fbddf050.tar.gz
nx-libs-914f88a8ab7bbbef3f0cb0674dfa5bd1fbddf050.tar.bz2
nx-libs-914f88a8ab7bbbef3f0cb0674dfa5bd1fbddf050.zip
XkbFindSrvLedInfo: remove extraneous name-clashing sli variable
Fix shadow warning: xkbLEDs.c: In function ‘XkbFindSrvLedInfo’: xkbLEDs.c:633:19: warning: declaration of ‘sli’ shadows a previous local [-Wshadow=compatible-local] XkbSrvLedInfoPtr sli; ^~~ xkbLEDs.c:629:18: note: shadowed declaration is here XkbSrvLedInfoPtr sli; ^~~ Backport of this xorg-xserver commit: commit d8eb9b5faa2d2c9350bdaffef8749a9cac3c87b8 Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Mon Dec 12 16:49:34 2011 -0800 XkbFindSrvLedInfo: remove extraneous name-clashing sli variable Variable is already defined outside the outer if statement, and there's no need to redefine inside the if statement. No point in setting sli before if (dev->kbdfeed->xkb_sli==NULL) check - if check is true, we immediately set it, if check is false, we immediately return without further reference or use of it. The one thing we do with it inside the inner if statement is store an allocation in it for a brief moment before writing to the final destination, which is immediately returned to the caller. In short, there's no benefit to the variable at all in this block, it just gives the optimizer more code to figure out how to omit. Fixes gcc warning: xkbLEDs.c: In function 'XkbFindSrvLedInfo': xkbLEDs.c:683:19: warning: declaration of 'sli' shadows a previous local xkbLEDs.c:679:18: warning: shadowed declaration is here Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'nx-X11')
-rw-r--r--nx-X11/programs/Xserver/xkb/xkbLEDs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/nx-X11/programs/Xserver/xkb/xkbLEDs.c b/nx-X11/programs/Xserver/xkb/xkbLEDs.c
index 0fccd0913..9853efad5 100644
--- a/nx-X11/programs/Xserver/xkb/xkbLEDs.c
+++ b/nx-X11/programs/Xserver/xkb/xkbLEDs.c
@@ -630,11 +630,9 @@ XkbSrvLedInfoPtr sli;
/* optimization to check for most common case */
if (((class==XkbDfltXIClass)&&(id==XkbDfltXIId))&&(dev->kbdfeed)) {
- XkbSrvLedInfoPtr sli;
- sli= dev->kbdfeed->xkb_sli;
if (dev->kbdfeed->xkb_sli==NULL) {
- sli= XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,needed_parts);
- dev->kbdfeed->xkb_sli= sli;
+ dev->kbdfeed->xkb_sli=
+ XkbAllocSrvLedInfo(dev,dev->kbdfeed,NULL,needed_parts);
}
return dev->kbdfeed->xkb_sli;
}