Move allocation of EvdevRec into a helper function

Makes it easier to initialise everything to the right values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2013-01-15 16:11:16 +10:00
parent 9ec9d214d0
commit 93de7b0b73

View File

@@ -2461,13 +2461,20 @@ EvdevUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
xf86DeleteInput(pInfo, flags);
}
static EvdevPtr
EvdevAlloc(void)
{
EvdevPtr pEvdev = calloc(sizeof(EvdevRec), 1);
return pEvdev;
}
static int
EvdevPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
{
EvdevPtr pEvdev;
int rc = BadAlloc;
if (!(pEvdev = calloc(sizeof(EvdevRec), 1)))
if (!(pEvdev = EvdevAlloc()))
goto error;
pInfo->private = pEvdev;