• Ulrich Sibiller's avatar
    XkbFindSrvLedInfo: remove extraneous name-clashing sli variable · 914f88a8
    Ulrich Sibiller authored
    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: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: 's avatarJamey Sharp <jamey@minilop.net>
    Reviewed-by: 's avatarPeter Hutterer <peter.hutterer@who-t.net>
    914f88a8
xkbLEDs.c 27.5 KB