[PATCH libXi] Stop unnecessary calls to size_classes
Peter Hutterer
peter.hutterer at who-t.net
Thu Nov 10 20:50:28 PST 2011
Xmalloc is a macro evaluating its argument twice.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/XIQueryDevice.c | 4 +++-
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;
--
1.7.7.1
More information about the xorg-devel
mailing list