[PATCH 3/5] Do not jump through the hoops to deallocate xkbbasedirflag variable

Mikhail Gusarov dottedmag at dottedmag.net
Wed May 12 13:33:12 PDT 2010


Fixes gcc warning as well.

Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
 xkb/ddxLoad.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index a9b5ca9..71772ae 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -185,8 +185,8 @@ XkbDDXCompileKeymapByNames(	XkbDescPtr		xkb,
     FILE *	out;
     char	*buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
 
-    const char	*emptystring = "";
-    const char	*xkbbasedirflag = emptystring;
+    char *emptystring = "";
+    char *xkbbasedirflag = NULL;
     const char	*xkbbindir = emptystring;
     const char	*xkbbindirsep = emptystring;
 
@@ -230,13 +230,11 @@ XkbDDXCompileKeymapByNames(	XkbDescPtr		xkb,
 		  xkbbindir, xkbbindirsep,
 		  ( (xkbDebugFlags < 2) ? 1 :
 		    ((xkbDebugFlags > 10) ? 10 : (int)xkbDebugFlags) ),
-		  xkbbasedirflag, xkmfile,
+		  xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
 		  PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
 		  xkm_output_dir, keymap);
 
-    if (xkbbasedirflag != emptystring) {
-	free(xkbbasedirflag);
-    }
+    free(xkbbasedirflag);
     
 #ifndef WIN32
     out= Popen(buf,"w");
-- 
1.7.1



More information about the xorg-devel mailing list