|
|
eb6a6e |
From c4fcd360d060d50673a4a35ed39c4fe7e4bc3561 Mon Sep 17 00:00:00 2001
|
|
|
eb6a6e |
From: Olivier Fourdan <ofourdan@redhat.com>
|
|
|
eb6a6e |
Date: Thu, 11 Apr 2019 09:05:15 +0200
|
|
|
eb6a6e |
Subject: [PATCH libICE 3/3] cleanup: Separate variable assignment and test
|
|
|
eb6a6e |
|
|
|
eb6a6e |
Assigning and testing a value in a single statement hinders code clarity
|
|
|
eb6a6e |
and may confuses static code analyzers.
|
|
|
eb6a6e |
|
|
|
eb6a6e |
Separate the assignment and the test for clarity.
|
|
|
eb6a6e |
|
|
|
eb6a6e |
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
|
|
eb6a6e |
---
|
|
|
eb6a6e |
src/process.c | 6 ++++--
|
|
|
eb6a6e |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
eb6a6e |
|
|
|
eb6a6e |
diff --git a/src/process.c b/src/process.c
|
|
|
eb6a6e |
index f0c3369..e3e0a35 100644
|
|
|
eb6a6e |
--- a/src/process.c
|
|
|
eb6a6e |
+++ b/src/process.c
|
|
|
eb6a6e |
@@ -919,7 +919,8 @@ ProcessConnectionSetup (
|
|
|
eb6a6e |
EXTRACT_STRING (pData, swap, vendor);
|
|
|
eb6a6e |
EXTRACT_STRING (pData, swap, release);
|
|
|
eb6a6e |
|
|
|
eb6a6e |
- if ((hisAuthCount = message->authCount) > 0)
|
|
|
eb6a6e |
+ hisAuthCount = message->authCount;
|
|
|
eb6a6e |
+ if (hisAuthCount > 0)
|
|
|
eb6a6e |
{
|
|
|
eb6a6e |
hisAuthNames = malloc (hisAuthCount * sizeof (char *));
|
|
|
eb6a6e |
EXTRACT_LISTOF_STRING (pData, swap, hisAuthCount, hisAuthNames);
|
|
|
eb6a6e |
@@ -1965,7 +1966,8 @@ ProcessProtocolSetup (
|
|
|
eb6a6e |
EXTRACT_STRING (pData, swap, vendor);
|
|
|
eb6a6e |
EXTRACT_STRING (pData, swap, release);
|
|
|
eb6a6e |
|
|
|
eb6a6e |
- if ((hisAuthCount = message->authCount) > 0)
|
|
|
eb6a6e |
+ hisAuthCount = message->authCount;
|
|
|
eb6a6e |
+ if (hisAuthCount > 0)
|
|
|
eb6a6e |
{
|
|
|
eb6a6e |
hisAuthNames = malloc (hisAuthCount * sizeof (char *));
|
|
|
eb6a6e |
EXTRACT_LISTOF_STRING (pData, swap, hisAuthCount, hisAuthNames);
|
|
|
eb6a6e |
--
|
|
|
eb6a6e |
2.21.0
|
|
|
eb6a6e |
|