diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-10 11:38:04 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-12-11 14:35:34 -0800 |
commit | 64761ee9424f755b84ab0ce02d13eda32d215a14 (patch) | |
tree | 0d5369ba1460fb9c4be686511de659ed653362ba /vmod.c | |
parent | 9737af15196380a1687d18a17d297ee17b45a83f (diff) |
Variable scope reductions
Some found by cppcheck, some found by manual code inspection
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'vmod.c')
-rw-r--r-- | vmod.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -47,8 +47,6 @@ InitVModInfo(VModInfo * info, XkbDescPtr xkb) void ClearVModInfo(VModInfo * info, XkbDescPtr xkb) { - int i; - if (XkbAllocNames(xkb, XkbVirtualModNamesMask, 0, 0) != Success) return; if (XkbAllocServerMap(xkb, XkbVirtualModsMask, 0) != Success) @@ -57,7 +55,8 @@ ClearVModInfo(VModInfo * info, XkbDescPtr xkb) info->newlyDefined = info->defined = info->available = 0; if (xkb && xkb->names) { - int bit; + int i, bit; + for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { if (xkb->names->vmods[i] != None) @@ -172,7 +171,6 @@ LookupVModIndex(XPointer priv, { int i; char *fieldStr; - char *modStr; XkbDescPtr xkb; xkb = (XkbDescPtr) priv; @@ -192,7 +190,7 @@ LookupVModIndex(XPointer priv, */ for (i = 0; i < XkbNumVirtualMods; i++) { - modStr = XkbAtomGetString(xkb->dpy, xkb->names->vmods[i]); + char *modStr = XkbAtomGetString(xkb->dpy, xkb->names->vmods[i]); if ((modStr != NULL) && (uStrCaseCmp(fieldStr, modStr) == 0)) { val_rtrn->uval = i; |