aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2018-07-16 22:22:10 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-11-09 15:31:57 +0100
commit6186383e70b56ba0782fae3c851779f2f079cbcd (patch)
treeb869f2acc3cf60ca49b33ad8f2e608fccb630725
parentb891e5f6859298c3482067752c9e4b2fd19ed617 (diff)
downloadnx-libs-6186383e70b56ba0782fae3c851779f2f079cbcd.tar.gz
nx-libs-6186383e70b56ba0782fae3c851779f2f079cbcd.tar.bz2
nx-libs-6186383e70b56ba0782fae3c851779f2f079cbcd.zip
Keyboard.c: simplify RLMVO string handling
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Keyboard.c46
1 files changed, 9 insertions, 37 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
index 103a817dd..9c0fd0212 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c
@@ -570,7 +570,6 @@ int nxagentKeyboardProc(DeviceIntPtr pDev, int onoff)
int i, j;
XKeyboardState values;
char *model = NULL, *layout = NULL;
- int free_model = 0, free_layout = 0;
XkbDescPtr xkb = NULL;
switch (onoff)
@@ -726,16 +725,9 @@ XkbError:
XkbFreeKeyboard(xkb, XkbAllComponentsMask, True);
xkb = NULL;
- if (free_model)
- {
- free_model = 0;
- free(model);
- }
- if (free_layout)
- {
- free_layout = 0;
- free(layout);
- }
+
+ free(model);
+ free(layout);
#endif
XGetKeyboardControl(nxagentDisplay, &values);
@@ -757,7 +749,7 @@ XkbError:
#ifdef XKB
} else { /* if (noXkbExtension) */
XkbComponentNamesRec names = {0};
- char *rules, *variants, *options;
+ char *rules = NULL, *variants = NULL, *options = NULL; /* use xkb default */
#ifdef TEST
fprintf(stderr, "nxagentKeyboardProc: Using XKB extension.\n");
@@ -767,8 +759,6 @@ XkbError:
fprintf(stderr, "nxagentKeyboardProc: nxagentKeyboard is [%s].\n", nxagentKeyboard ? nxagentKeyboard : "NULL");
#endif
- rules = NULL; /* use xkb default */
-
/*
from nxagent changelog:
2.0.22:
@@ -791,11 +781,8 @@ XkbError:
goto XkbError;
}
- free_model = 1;
- model = strndup(nxagentKeyboard, i);
-
- free_layout = 1;
- layout = strdup(&nxagentKeyboard[i + 1]);
+ model = strndup(nxagentKeyboard, i);
+ layout = strdup(&nxagentKeyboard[i + 1]);
/*
* There is no description for pc105 on Solaris.
@@ -824,18 +811,12 @@ XkbError:
}
else
{
- layout = NULL; /* use xkb default */
- model = NULL; /* use xkb default */
-
#ifdef TEST
fprintf(stderr, "nxagentKeyboardProc: Using default keyboard: model [%s] layout [%s].\n",
model, layout);
#endif
}
- variants = NULL; /* use xkb default */
- options = NULL; /* use xkb default */
-
#ifdef TEST
fprintf(stderr, "nxagentKeyboardProc: Init XKB extension.\n");
#endif
@@ -900,20 +881,11 @@ XkbEnd:
NXShadowInitKeymap(&(pDev->key->curKeySyms));
}
- if (free_model)
- {
- free_model = 0;
- free(model);
- }
-
- if (free_layout)
- {
- free_layout = 0;
- free(layout);
- }
-
XkbFreeKeyboard(xkb, XkbAllComponentsMask, True);
xkb = NULL;
+
+ free(model);
+ free(layout);
}
#endif