[X2Go-Commits] [nx-libs] 88/108: Keyboard.c: simplify RLMVO string handling

git-admin at x2go.org git-admin at x2go.org
Fri Nov 9 20:35:56 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository nx-libs.

commit 6186383e70b56ba0782fae3c851779f2f079cbcd
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Mon Jul 16 22:22:10 2018 +0200

    Keyboard.c: simplify RLMVO string handling
---
 nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 46 ++++++---------------------
 1 file 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 103a817..9c0fd02 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
 

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list