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

Peter Hutterer peter.hutterer at who-t.net
Mon Oct 18 16:01:28 PDT 2010


On Mon, Oct 18, 2010 at 11:38:28AM -0400, Trevor Woerner wrote:
> From: Trevor Woerner <twoerner at gmail.com>
> 
> Replace calls to deprecated functions with calls to standard dynamic
> memory functions in driver code.
> 
> Signed-off-by: Trevor Woerner <twoerner at gmail.com>

pushed, thanks

> ---
>  src/kbd.c        |    6 +++---
>  src/lnx_KbdMap.c |    6 +++---
>  src/lnx_kbd.c    |   10 +++++-----
>  3 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/src/kbd.c b/src/kbd.c
> index a9d4890..b5b3996 100644
> --- a/src/kbd.c
> +++ b/src/kbd.c
> @@ -120,7 +120,7 @@ SetXkbOption(InputInfoPtr pInfo, char *name, char **option)
>  
>     if ((s = xf86SetStrOption(pInfo->options, name, NULL))) {
>         if (!s[0]) {
> -           xfree(s);
> +           free(s);
>             *option = NULL;
>         } else {
>             *option = s;
> @@ -167,7 +167,7 @@ KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
>          xf86CollectInputOptions(pInfo, kbd98Defaults, NULL);
>      xf86ProcessCommonOptions(pInfo, pInfo->options); 
>  
> -    if (!(pKbd = xcalloc(sizeof(KbdDevRec), 1)))
> +    if (!(pKbd = calloc(sizeof(KbdDevRec), 1)))
>          return pInfo;
>  
>      pInfo->private = pKbd;
> @@ -193,7 +193,7 @@ KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
>      	    }
>      	    l = strtok(NULL, " \t\n");
>          }
> -        xfree(s);
> +        free(s);
>      }
>  
>      SetXkbOption(pInfo, "XkbRules", &xkb_rules);
> diff --git a/src/lnx_KbdMap.c b/src/lnx_KbdMap.c
> index 6dde256..7032b0f 100644
> --- a/src/lnx_KbdMap.c
> +++ b/src/lnx_KbdMap.c
> @@ -522,12 +522,12 @@ readKernelMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap)
>    /*
>     * Find the Mapping for the special server functions
>     */
> -  pKbd->specialMap = (TransMapPtr) xcalloc(NUM_CUSTOMKEYS, 1);
> +  pKbd->specialMap = (TransMapPtr) calloc(NUM_CUSTOMKEYS, 1);
>    if (pKbd->specialMap != NULL) {
>        pKbd->specialMap->end = NUM_CUSTOMKEYS;
> -      pKbd->specialMap->map = (unsigned char*) xcalloc(NUM_CUSTOMKEYS, 1);
> +      pKbd->specialMap->map = (unsigned char*) calloc(NUM_CUSTOMKEYS, 1);
>        if (pKbd->specialMap == NULL) {
> -      	  xfree(pKbd->specialMap);
> +      	  free(pKbd->specialMap);
>        	  pKbd->specialMap = NULL;
>        }
>    }
> diff --git a/src/lnx_kbd.c b/src/lnx_kbd.c
> index 4dcf492..9b3aae3 100644
> --- a/src/lnx_kbd.c
> +++ b/src/lnx_kbd.c
> @@ -181,12 +181,12 @@ OpenKeyboard(InputInfoPtr pInfo)
>             break;
>          default:
>             xf86Msg(X_ERROR,"\"%s\" is not a valid keyboard protocol name\n", s);
> -           xfree(s);
> +           free(s);
>             return FALSE;
>      }
>  
>      xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, s);
> -    xfree(s);
> +    free(s);
>  
>      s = xf86SetStrOption(pInfo->options, "Device", NULL);
>      if (s == NULL) {
> @@ -196,11 +196,11 @@ OpenKeyboard(InputInfoPtr pInfo)
>         pInfo->fd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL);
>         if (pInfo->fd == -1) {
>             xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, s);
> -           xfree(s);
> +           free(s);
>             return FALSE;
>         }
>         pKbd->isConsole = FALSE;
> -       xfree(s);
> +       free(s);
>      }
>  
>      if (pKbd->isConsole)
> @@ -227,7 +227,7 @@ xf86OSKbdPreInit(InputInfoPtr pInfo)
>      pKbd->OpenKeyboard = OpenKeyboard;
>      pKbd->vtSwitchSupported = FALSE;
>  
> -    pKbd->private = xcalloc(sizeof(LnxKbdPrivRec), 1);
> +    pKbd->private = calloc(sizeof(LnxKbdPrivRec), 1);
>      if (pKbd->private == NULL) {
>         xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
>         return FALSE;
> -- 
> 1.7.3.1.104.gc752e
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 
Cheers,
  Peter


More information about the xorg-devel mailing list