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

Thomas Hellstrom thellstrom at vmware.com
Tue Oct 19 23:19:07 PDT 2010


Reviewed-by: Thomas Hellstrom <thellstrom at vmware.com>

On 10/19/2010 09:09 PM, Trevor Woerner wrote:
> From: Trevor Woerner<twoerner at gmail.com>
>
> Replace calls to deprecated dynamic memory wrapper functions
> in driver code.
>
> Signed-off-by: Trevor Woerner<twoerner at gmail.com>
> ---
>   configure.ac  |    4 ++++
>   src/vmmouse.c |   23 ++++++++++++++---------
>   2 files changed, 18 insertions(+), 9 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 8c1322c..d5b89c6 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -127,6 +127,10 @@ PKG_CHECK_EXISTS([xorg-server>= 1.1.0],
>                    [AC_DEFINE([HAVE_XORG_SERVER_1_1_0], 1,
>                               [Has version 1.1.0 or greater of the Xserver])])
>
> +PKG_CHECK_EXISTS([xorg-server>  1.4.99],
> +		[AC_DEFINE([HAVE_XORG_SERVER_1_5_0], 1,
> +		[Has version 1.5.0 or greater of the Xserver])])
> +
>   PKG_CHECK_EXISTS([xorg-server>= 1.3.99.0 xorg-server<= 1.4.0.90],
>                    [AC_DEFINE([CALL_CONVERSION_PROC], 1,
>                               [Call conversion_proc from within the driver, as
> diff --git a/src/vmmouse.c b/src/vmmouse.c
> index f5ad234..1dfe5be 100644
> --- a/src/vmmouse.c
> +++ b/src/vmmouse.c
> @@ -75,6 +75,11 @@
>   #include "xisb.h"
>   #include "mipointer.h"
>
> +#ifndef HAVE_XORG_SERVER_1_5_0
> +#include<xf86_ansic.h>
> +#include<xf86_libc.h>
> +#endif
> +
>   /*****************************************************************************
>    *	Local Headers
>    ****************************************************************************/
> @@ -249,7 +254,7 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
>   }
>   #endif
>
> -   mPriv = xcalloc (1, sizeof (VMMousePrivRec));
> +   mPriv = calloc (1, sizeof (VMMousePrivRec));
>
>
>      if (!mPriv) {
> @@ -270,7 +275,7 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
>         xf86Msg(X_ERROR, "VMWARE(0): vmmouse enable failed\n");
>         mPriv->vmmouseAvailable = FALSE;
>         passthruMouse = (InputDriverRec *)LoaderSymbol("MOUSE");
> -      xfree(mPriv);
> +      free(mPriv);
>         if(passthruMouse != NULL){
>   	 return (passthruMouse->PreInit)(drv, dev, flags);
>         } else {
> @@ -291,7 +296,7 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
>      }
>
>      if (!(pInfo = xf86AllocateInput(drv, 0))) {
> -      xfree(mPriv);
> +      free(mPriv);
>         return NULL;
>      }
>
> @@ -316,8 +321,8 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
>      pInfo->conf_idev = dev;
>
>      /* Allocate the MouseDevRec and initialise it. */
> -   if (!(pMse = xcalloc(sizeof(MouseDevRec), 1))) {
> -      xfree(mPriv);
> +   if (!(pMse = calloc(sizeof(MouseDevRec), 1))) {
> +      free(mPriv);
>         return pInfo;
>      }
>
> @@ -340,8 +345,8 @@ VMMousePreInit(InputDriverPtr drv, IDevPtr dev, int flags)
>         else {
>   	 xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name);
>   	 if (pMse->mousePriv)
> -	    xfree(pMse->mousePriv);
> -	 xfree(pMse);
> +	    free(pMse->mousePriv);
> +	 free(pMse);
>   	 pInfo->private = NULL;
>   	 return pInfo;
>         }
> @@ -645,7 +650,7 @@ MouseCommonOptions(InputInfoPtr pInfo)
>         }
>         if (msg) {
>   	 xf86Msg(X_CONFIG, "%s: ZAxisMapping: %s\n", pInfo->name, msg);
> -	 xfree(msg);
> +	 free(msg);
>         } else {
>   	 xf86Msg(X_WARNING, "%s: Invalid ZAxisMapping value: \"%s\"\n",
>   		 pInfo->name, s);
> @@ -1201,7 +1206,7 @@ VMMousePlug(pointer	module,
>      if (!LoadSubModule(module, name, NULL, NULL, NULL, NULL, errmaj, errmin)) {
>         LoaderErrorMsg(NULL, name, *errmaj, *errmin);
>      }
> -   xfree(name);
> +   free(name);
>   }
>   #endif
>
>    



More information about the xorg-devel mailing list