test: initialize a variable to make scan-build happy
authorPeter Hutterer <peter.hutterer@who-t.net>
Sun, 13 Oct 2024 01:06:39 +0000 (11:06 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 15 Oct 2024 02:44:27 +0000 (12:44 +1000)
Assuming safe_atoi works as expected, `fuzz` cannot be
uninitialized by the time we get here. But let's init it anyway to make
scan-build happy.

[202/249] Compiling C object libinput-test-suite.p/test_test-touch.c.o
../../../test/test-touch.c:964:2: warning: Assigned value is garbage or undefined [core.uninitialized.Assign]
  964 |         litest_assert_int_eq(fuzz, 10); /* device-specific */
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note that this error message is the result of a follow-up commit,
this commit is shuffled before so we have bisectable build.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1059>

test/test-touch.c

index b6a2cc2f563c8f2999ce3c8ff13c5633a832b0a2..a1616408d7d29c2bfc5ac269078d140806ab8490 100644 (file)
@@ -952,7 +952,7 @@ START_TEST(touch_fuzz_property)
        struct litest_device *dev = litest_current_device();
        struct udev_device *d;
        const char *prop;
-       int fuzz;
+       int fuzz = 0;
 
        ck_assert_int_eq(libevdev_get_abs_fuzz(dev->evdev, ABS_X), 0);
        ck_assert_int_eq(libevdev_get_abs_fuzz(dev->evdev, ABS_Y), 0);