[PATCH evdev 1/4] Move allocation of EvdevRec into a helper function
Peter Hutterer
peter.hutterer at who-t.net
Tue Jan 15 15:34:07 PST 2013
Makes it easier to initialise everything to the right values.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/evdev.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/evdev.c b/src/evdev.c
index 5667dc1..baa7ac1 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -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;
--
1.8.1
More information about the xorg-devel
mailing list