[PATCH xf86-input-joystick 1/2] Deprecated code cleanup.

Trevor Woerner twoerner at gmail.com
Sun Oct 17 18:25:56 PDT 2010


From: Trevor Woerner <twoerner at gmail.com>

Replace calls to deprecated functions (Xfree(), Xcalloc(), Xmalloc(), etc)
with calls to standard dynamic memory functions (free(), calloc(), malloc(),
etc) in driver code.

Signed-off-by: Trevor Woerner <twoerner at gmail.com>
---
 src/jstk.c         |    8 ++++----
 src/jstk_key.c     |    8 ++++----
 src/jstk_options.c |    4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/jstk.c b/src/jstk.c
index 95fb093..fbfe905 100644
--- a/src/jstk.c
+++ b/src/jstk.c
@@ -524,7 +524,7 @@ jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
         goto SetupProc_fail;
     }
 
-    local->private = (JoystickDevPtr)xalloc(sizeof(JoystickDevRec));
+    local->private = (JoystickDevPtr)malloc(sizeof(JoystickDevRec));
     priv = (JoystickDevPtr)local->private;
 
     local->name   = dev->identifier;
@@ -657,7 +657,7 @@ jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
             DBG(1, xf86Msg(X_CONFIG, "Autorepeat set to delay=%d, interval=%d\n",
                            priv->repeat_delay,priv->repeat_interval));
         }
-        xfree(s);
+        free(s);
     }
     
     priv->rmlvo.rules = xf86SetStrOption(dev->commonOptions, "xkb_rules", NULL);
@@ -722,7 +722,7 @@ jstkCorePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
 
 SetupProc_fail:
     if (priv)
-        xfree(priv);
+        free(priv);
     if (local)
         local->private = NULL;
     return NULL;
@@ -754,7 +754,7 @@ jstkCoreUnInit(InputDriverPtr    drv,
         device->keyboard_device = NULL;
     }
 
-    xfree (device);
+    free (device);
     local->private = NULL;
     xf86DeleteInput(local, 0);
 }
diff --git a/src/jstk_key.c b/src/jstk_key.c
index c841cf0..35b8928 100644
--- a/src/jstk_key.c
+++ b/src/jstk_key.c
@@ -506,7 +506,7 @@ jstkKeyboardPreInit(InputDriverPtr drv, IDevPtr _dev, int flags)
         goto SetupProc_fail;
     }
 
-    dev = xcalloc(sizeof(IDevRec), 1);
+    dev = calloc(sizeof(IDevRec), 1);
     strcpy(name, _dev->identifier);
     strcat(name, " (keys)");
     dev->identifier = xstrdup(name);
@@ -544,9 +544,9 @@ SetupProc_fail:
     if (local)
         local->private = NULL;
     if (dev) {
-        if (dev->identifier) xfree(dev->identifier);
-        if (dev->driver) xfree(dev->driver);
-        xfree(dev);
+        if (dev->identifier) free(dev->identifier);
+        if (dev->driver) free(dev->driver);
+        free(dev);
     }
     return NULL;
 }
diff --git a/src/jstk_options.c b/src/jstk_options.c
index 4ce9d36..65f25f8 100644
--- a/src/jstk_options.c
+++ b/src/jstk_options.c
@@ -155,7 +155,7 @@ jstkParseButtonOption(const char* org,
         xf86Msg(X_WARNING, "%s: error parsing button parameter.\n", 
                 name);
     }
-    xfree(param);
+    free(param);
 }
 
 
@@ -293,5 +293,5 @@ jstkParseAxisOption(const char* org,
         }else xf86Msg(X_WARNING, "%s: error parsing deadzone.\n", 
                       name);
     }
-    xfree(param);
+    free(param);
 }
-- 
1.7.3.1.120.g38a18



More information about the xorg-devel mailing list