[PATCH libevdev 07/13] Simplify getter/setter macros
Peter Hutterer
peter.hutterer at who-t.net
Sun Aug 25 16:27:27 PDT 2013
Now that we've dropped the deprecated API, we can simplify the macros a bit.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
libevdev/libevdev.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 3f95716..db6f950 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -676,16 +676,16 @@ STRING_SETTER(phys);
STRING_SETTER(uniq);
-#define PRODUCT_GETTER(name, field) \
-int libevdev_get_##name(const struct libevdev *dev) \
+#define PRODUCT_GETTER(name) \
+int libevdev_get_id_##name(const struct libevdev *dev) \
{ \
- return dev->ids.field; \
+ return dev->ids.name; \
}
-PRODUCT_GETTER(id_product, product);
-PRODUCT_GETTER(id_vendor, vendor);
-PRODUCT_GETTER(id_bustype, bustype);
-PRODUCT_GETTER(id_version, version);
+PRODUCT_GETTER(product);
+PRODUCT_GETTER(vendor);
+PRODUCT_GETTER(bustype);
+PRODUCT_GETTER(version);
#define PRODUCT_SETTER(field) \
void libevdev_set_id_##field(struct libevdev *dev, int field) \
@@ -825,18 +825,18 @@ libevdev_get_abs_info(const struct libevdev *dev, unsigned int code)
return &dev->abs_info[code];
}
-#define ABS_GETTER(name, field) \
+#define ABS_GETTER(name) \
int libevdev_get_abs_##name(const struct libevdev *dev, unsigned int code) \
{ \
const struct input_absinfo *absinfo = libevdev_get_abs_info(dev, code); \
- return absinfo ? absinfo->field : 0; \
+ return absinfo ? absinfo->name : 0; \
}
-ABS_GETTER(maximum, maximum);
-ABS_GETTER(minimum, minimum);
-ABS_GETTER(fuzz, fuzz)
-ABS_GETTER(flat, flat)
-ABS_GETTER(resolution, resolution)
+ABS_GETTER(maximum);
+ABS_GETTER(minimum);
+ABS_GETTER(fuzz);
+ABS_GETTER(flat);
+ABS_GETTER(resolution);
#define ABS_SETTER(field) \
void libevdev_set_abs_##field(struct libevdev *dev, unsigned int code, int val) \
--
1.8.2.1
More information about the Input-tools
mailing list