From c311687d90564f670e1ec943371c5cab4711f3e3 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 8 Dec 2022 14:47:33 -0800 Subject: Ensure screenNum is always initialized Clears this warning from clang, even though it seems like a false positive, as all the uses are behind the same conditions: xdriinfo.c:117:27: warning: variable 'screenNum' may be uninitialized when used here [-Wconditional-uninitialized] if (func == DRIVER && screenNum == -1) { ^~~~~~~~~ xdriinfo.c:61:28: note: initialize the variable 'screenNum' to silence this warning int nScreens, screenNum; Signed-off-by: Alan Coopersmith --- xdriinfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xdriinfo.c b/xdriinfo.c index 1bca9c4..35d7458 100644 --- a/xdriinfo.c +++ b/xdriinfo.c @@ -112,6 +112,8 @@ int main (int argc, char *argv[]) { return 1; } } + else + screenNum = -1; /* driver command needs a valid screen number */ if (func == DRIVER && screenNum == -1) { -- cgit v1.2.3