[PATCH 4/8] xwin: Get rid of xstrdup when argument is definitely non-NULL

Mikhail Gusarov dottedmag at dottedmag.net
Fri Jun 4 03:25:01 PDT 2010


ditto for XWin

Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
 hw/xwin/InitOutput.c   |    6 +++---
 hw/xwin/glx/indirect.c |    6 +++---
 hw/xwin/winconfig.c    |    4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index 1ab059f..1b97606 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -441,7 +441,7 @@ winFixupPaths (void)
             int comment_block = FALSE;
 
             /* get defautl fontpath */
-            char *fontpath = xstrdup(defaultFontPath);
+            char *fontpath = strdup(defaultFontPath);
             size_t size = strlen(fontpath);
 
             /* read all lines */
@@ -528,7 +528,7 @@ winFixupPaths (void)
 
             /* cleanup */
             fclose(fontdirs);  
-            defaultFontPath = xstrdup(fontpath);
+            defaultFontPath = strdup(fontpath);
             free(fontpath);
             changed_fontpath = TRUE;
             font_from = X_CONFIG;
@@ -600,7 +600,7 @@ winFixupPaths (void)
             }
         } 
 
-        defaultFontPath = xstrdup(newfp);
+        defaultFontPath = strdup(newfp);
         free(newfp);
         changed_fontpath = TRUE;
     }
diff --git a/hw/xwin/glx/indirect.c b/hw/xwin/glx/indirect.c
index 5e0e917..8ec40da 100755
--- a/hw/xwin/glx/indirect.c
+++ b/hw/xwin/glx/indirect.c
@@ -676,7 +676,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
       fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs);
 
       // Override the GL extensions string set by __glXScreenInit()
-      screen->base.GLextensions = xstrdup(gl_extensions);
+      screen->base.GLextensions = strdup(gl_extensions);
 
       // Generate the GLX extensions string (overrides that set by __glXScreenInit())
       {
@@ -706,13 +706,13 @@ glxWinScreenProbe(ScreenPtr pScreen)
 
           if (screen->has_WGL_ARB_multisample)
             {
-              screen->base.GLXversion = xstrdup("1.4");
+              screen->base.GLXversion = strdup("1.4");
               screen->base.GLXmajor = 1;
               screen->base.GLXminor = 4;
             }
           else
             {
-              screen->base.GLXversion = xstrdup("1.3");
+              screen->base.GLXversion = strdup("1.3");
               screen->base.GLXmajor = 1;
               screen->base.GLXminor = 3;
             }
diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c
index c2dd056..e336237 100644
--- a/hw/xwin/winconfig.c
+++ b/hw/xwin/winconfig.c
@@ -583,7 +583,7 @@ winConfigFiles ()
   else if (filesptr != NULL && filesptr->file_fontpath)
     {
       from = X_CONFIG;
-      defaultFontPath = xstrdup (filesptr->file_fontpath);
+      defaultFontPath = strdup (filesptr->file_fontpath);
     }
   winMsg (from, "FontPath set to \"%s\"\n", defaultFontPath);
 
@@ -630,7 +630,7 @@ winSetStrOption (pointer optlist, const char *name, char *deflt)
   if (ParseOptionValue (-1, optlist, &o))
     deflt = o.value.str;
   if (deflt)
-    return xstrdup (deflt);
+    return strdup (deflt);
   else
     return NULL;
 }
-- 
1.7.1



More information about the xorg-devel mailing list