summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-10-26 08:55:35 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-11-12 17:41:34 +1000
commitba83a1e58592e41f207524f106ba26dd71fe4171 (patch)
treea574fd0a24e1a220f091816b2df167b9460122dc /src
parent6d6ae8fc8b9620bf864ac7dff8d818573eee3e4f (diff)
Stop unnecessary calls to size_classes
Xmalloc is a macro evaluating its argument twice. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'src')
-rw-r--r--src/XIQueryDevice.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/XIQueryDevice.c b/src/XIQueryDevice.c
index af2f27a..66452c2 100644
--- a/src/XIQueryDevice.c
+++ b/src/XIQueryDevice.c
@@ -71,6 +71,7 @@ XIQueryDevice(Display *dpy, int deviceid, int *ndevices_return)
for (i = 0; i < reply.num_devices; i++)
{
int nclasses;
+ size_t sz;
XIDeviceInfo *lib = &info[i];
xXIDeviceInfo *wire = (xXIDeviceInfo*)ptr;
@@ -86,7 +87,8 @@ XIQueryDevice(Display *dpy, int deviceid, int *ndevices_return)
strncpy(lib->name, ptr, wire->name_len);
ptr += ((wire->name_len + 3)/4) * 4;
- lib->classes = Xmalloc(size_classes((xXIAnyInfo*)ptr, nclasses));
+ sz = size_classes((xXIAnyInfo*)ptr, nclasses);
+ lib->classes = Xmalloc(sz);
ptr += copy_classes(lib, (xXIAnyInfo*)ptr, &nclasses);
/* We skip over unused classes */
lib->num_classes = nclasses;