[PATCH:xts 11/16] xts5: Add parentheses around assignment in an if.

Cyril Brulebois kibi at debian.org
Wed May 25 04:00:20 PDT 2011


Tell compilers we really meant to assign and then check.

The following warning goes away accordingly:
|   CC     nextvclass.lo
| nextvclass.c:224:14: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
|                         if (comma = strchr(++s, COMMA))
|                             ~~~~~~^~~~~~~~~~~~~~~~~~~~
| nextvclass.c:224:14: note: use '==' to turn this assignment into an equality comparison
|                         if (comma = strchr(++s, COMMA))
|                                   ^
|                                   ==
| nextvclass.c:224:14: note: place parentheses around the assignment to silence this warning
|                         if (comma = strchr(++s, COMMA))
|                                   ^
|                             (                         )

Signed-off-by: Cyril Brulebois <kibi at debian.org>
---
 xts5/src/lib/nextvclass.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/xts5/src/lib/nextvclass.c b/xts5/src/lib/nextvclass.c
index 13b7f6c..7a6a5f2 100644
--- a/xts5/src/lib/nextvclass.c
+++ b/xts5/src/lib/nextvclass.c
@@ -221,7 +221,7 @@ int	Lclass;
 		}
 		Lclass = Nclass;
 		for (s = left_bracket; s; s = comma) {
-			if (comma = strchr(++s, COMMA))
+			if ((comma = strchr(++s, COMMA)))
 				*comma = '\0';
 			if (*s == '\0')
 				break;
-- 
1.7.5.1



More information about the xorg-devel mailing list