summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-08 14:47:33 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-12-08 14:50:46 -0800
commitc311687d90564f670e1ec943371c5cab4711f3e3 (patch)
tree5dcd637478c8db17e5ec6924e4c0c30eb2b6f511
parenta318124b38bbfac36f6bfe537839b0d3a9065b94 (diff)
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 <alan.coopersmith@oracle.com>
-rw-r--r--xdriinfo.c2
1 files changed, 2 insertions, 0 deletions
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) {