[PATCH v2 libinput 3/6] util: rename the pressure range parser to a more generic range_parser

Peter Hutterer peter.hutterer at who-t.net
Tue Jul 11 04:09:23 UTC 2017


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c |  2 +-
 src/libinput-util.c     |  2 +-
 src/libinput-util.h     |  2 +-
 test/test-misc.c        | 12 ++++++------
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 6ef356b5..14bb5c84 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -2614,7 +2614,7 @@ tp_init_pressure(struct tp_dispatch *tp,
 	prop = udev_device_get_property_value(device->udev_device,
 					      "LIBINPUT_ATTR_PRESSURE_RANGE");
 	if (prop) {
-		if (!parse_pressure_range_property(prop, &hi, &lo)) {
+		if (!parse_range_property(prop, &hi, &lo)) {
 			evdev_log_bug_client(device,
 				     "discarding invalid pressure range '%s'\n",
 				     prop);
diff --git a/src/libinput-util.c b/src/libinput-util.c
index 9104e9d9..df7a1f3b 100644
--- a/src/libinput-util.c
+++ b/src/libinput-util.c
@@ -379,7 +379,7 @@ parse_tpkbcombo_layout_poperty(const char *prop,
  * @return true on success, false otherwise
  */
 bool
-parse_pressure_range_property(const char *prop, int *hi, int *lo)
+parse_range_property(const char *prop, int *hi, int *lo)
 {
 	int first, second;
 
diff --git a/src/libinput-util.h b/src/libinput-util.h
index ebadb9ff..30ab48cd 100644
--- a/src/libinput-util.h
+++ b/src/libinput-util.h
@@ -388,7 +388,7 @@ int parse_mouse_wheel_click_count_property(const char *prop);
 double parse_trackpoint_accel_property(const char *prop);
 bool parse_dimension_property(const char *prop, size_t *width, size_t *height);
 bool parse_calibration_property(const char *prop, float calibration[6]);
-bool parse_pressure_range_property(const char *prop, int *hi, int *lo);
+bool parse_range_property(const char *prop, int *hi, int *lo);
 int parse_palm_pressure_property(const char *prop);
 
 enum tpkbcombo_layout {
diff --git a/test/test-misc.c b/test/test-misc.c
index 6a9760f0..2173910b 100644
--- a/test/test-misc.c
+++ b/test/test-misc.c
@@ -1002,15 +1002,15 @@ START_TEST(calibration_prop_parser)
 }
 END_TEST
 
-struct parser_test_pressure_range {
+struct parser_test_range {
 	char *tag;
 	bool success;
 	int hi, lo;
 };
 
-START_TEST(pressure_range_prop_parser)
+START_TEST(range_prop_parser)
 {
-	struct parser_test_pressure_range tests[] = {
+	struct parser_test_range tests[] = {
 		{ "10:8", true, 10, 8 },
 		{ "100:-1", true, 100, -1 },
 		{ "-203813:-502023", true, -203813, -502023 },
@@ -1028,7 +1028,7 @@ START_TEST(pressure_range_prop_parser)
 
 	for (i = 0; tests[i].tag != NULL; i++) {
 		hi = lo = 0xad;
-		success = parse_pressure_range_property(tests[i].tag, &hi, &lo);
+		success = parse_range_property(tests[i].tag, &hi, &lo);
 		ck_assert(success == tests[i].success);
 		if (success) {
 			ck_assert_int_eq(hi, tests[i].hi);
@@ -1039,7 +1039,7 @@ START_TEST(pressure_range_prop_parser)
 		}
 	}
 
-	success = parse_pressure_range_property(NULL, NULL, NULL);
+	success = parse_range_property(NULL, NULL, NULL);
 	ck_assert(success == false);
 }
 END_TEST
@@ -1373,7 +1373,7 @@ litest_setup_tests_misc(void)
 	litest_add_no_device("misc:parser", dimension_prop_parser);
 	litest_add_no_device("misc:parser", reliability_prop_parser);
 	litest_add_no_device("misc:parser", calibration_prop_parser);
-	litest_add_no_device("misc:parser", pressure_range_prop_parser);
+	litest_add_no_device("misc:parser", range_prop_parser);
 	litest_add_no_device("misc:parser", palm_pressure_parser);
 	litest_add_no_device("misc:parser", safe_atoi_test);
 	litest_add_no_device("misc:parser", safe_atod_test);
-- 
2.13.0



More information about the wayland-devel mailing list