|
|
82d5c8 |
From 215a01f1513f918e7295a8a477d4674f7b8085f0 Mon Sep 17 00:00:00 2001
|
|
|
82d5c8 |
From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
|
|
|
82d5c8 |
Date: Wed, 18 Jan 2017 08:52:23 +0100
|
|
|
82d5c8 |
Subject: [PATCH app/xrandr] xrandr: suppress misleading indentation warning
|
|
|
82d5c8 |
|
|
|
82d5c8 |
When printing out rotations, we print a space before any item other than
|
|
|
82d5c8 |
the first, and set `first = False` in each block where we print.
|
|
|
82d5c8 |
However, this is done in the same line as the conditional that checks if
|
|
|
82d5c8 |
first is set, which may give the impression that the assignment is also
|
|
|
82d5c8 |
under the conditional. This is not the case, and recent GCC warns about
|
|
|
82d5c8 |
this.
|
|
|
82d5c8 |
|
|
|
82d5c8 |
Move the assignment to after we print the value we want to print, which
|
|
|
82d5c8 |
(1) doesn't mislead about the indentation, and
|
|
|
82d5c8 |
(2) makes logical sense as the _next_ entry is what won't be the first.
|
|
|
82d5c8 |
|
|
|
82d5c8 |
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
|
|
|
82d5c8 |
---
|
|
|
82d5c8 |
xrandr.c | 6 ++++--
|
|
|
82d5c8 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
82d5c8 |
|
|
|
82d5c8 |
diff --git a/xrandr.c b/xrandr.c
|
|
|
82d5c8 |
index dcfdde0..2aad946 100644
|
|
|
82d5c8 |
--- a/xrandr.c
|
|
|
82d5c8 |
+++ b/xrandr.c
|
|
|
82d5c8 |
@@ -3703,14 +3703,16 @@ main (int argc, char **argv)
|
|
|
82d5c8 |
printf (" (");
|
|
|
82d5c8 |
for (i = 0; i < 4; i ++) {
|
|
|
82d5c8 |
if ((rotations >> i) & 1) {
|
|
|
82d5c8 |
- if (!first) printf (" "); first = False;
|
|
|
82d5c8 |
+ if (!first) printf (" ");
|
|
|
82d5c8 |
printf("%s", direction[i]);
|
|
|
82d5c8 |
+ first = False;
|
|
|
82d5c8 |
}
|
|
|
82d5c8 |
}
|
|
|
82d5c8 |
if (rotations & RR_Reflect_X)
|
|
|
82d5c8 |
{
|
|
|
82d5c8 |
- if (!first) printf (" "); first = False;
|
|
|
82d5c8 |
+ if (!first) printf (" ");
|
|
|
82d5c8 |
printf ("x axis");
|
|
|
82d5c8 |
+ first = False;
|
|
|
82d5c8 |
}
|
|
|
82d5c8 |
if (rotations & RR_Reflect_Y)
|
|
|
82d5c8 |
{
|
|
|
82d5c8 |
--
|
|
|
82d5c8 |
2.17.1
|
|
|
82d5c8 |
|