Simplify getter/setter macros
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 23 Aug 2013 00:49:56 +0000 (10:49 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 29 Aug 2013 01:36:20 +0000 (11:36 +1000)
Now that we've dropped the deprecated API, we can simplify the macros a bit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
libevdev/libevdev.c

index 0c8cb2f..39a79fc 100644 (file)
@@ -785,16 +785,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) \
@@ -985,18 +985,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) \