[PATCH libICE 05/13] add errormessage and remove unneeded indention
walter harms
wharms at bfs.de
Wed Oct 18 15:57:26 UTC 2017
add errormessage and remove unneeded indention
Signed-off-by: Walter Harms <wharms at bfs.de>
---
src/listen.c | 51 +++++++++++++++++++++++++--------------------------
1 file changed, 25 insertions(+), 26 deletions(-)
diff --git a/src/listen.c b/src/listen.c
index 9a449ae..54aabcd 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -67,6 +67,8 @@ IceListenForConnections (
for (i = 0; i < transCount; i++)
_IceTransClose (transConns[i]);
free (transConns);
+ strncpy (errorStringRet,
+ "Out of memmory", errorLength);
return (0);
}
@@ -186,6 +188,7 @@ IceComposeNetworkIdList (
char *list;
int len = 0;
int i;
+ int doneCount = 0;
if (count < 1 || listenObjs == NULL)
return (NULL);
@@ -197,39 +200,35 @@ IceComposeNetworkIdList (
if (list == NULL)
return (NULL);
- else
- {
- int doneCount = 0;
- list[0] = '\0';
+ list[0] = '\0';
+ for (i = 0; i < count; i++)
+ {
+ if (_IceTransIsLocal (listenObjs[i]->trans_conn))
+ {
+ strcat (list, listenObjs[i]->network_id);
+ doneCount++;
+ if (doneCount < count)
+ strcat (list, ",");
+ }
+ }
+
+ if (doneCount < count)
+ {
for (i = 0; i < count; i++)
- {
- if (_IceTransIsLocal (listenObjs[i]->trans_conn))
- {
+ {
+ if (!_IceTransIsLocal (listenObjs[i]->trans_conn))
+ {
strcat (list, listenObjs[i]->network_id);
doneCount++;
if (doneCount < count)
- strcat (list, ",");
- }
- }
+ strcat (list, ",");
+ }
+ }
+ }
- if (doneCount < count)
- {
- for (i = 0; i < count; i++)
- {
- if (!_IceTransIsLocal (listenObjs[i]->trans_conn))
- {
- strcat (list, listenObjs[i]->network_id);
- doneCount++;
- if (doneCount < count)
- strcat (list, ",");
- }
- }
- }
-
- return (list);
- }
+ return (list);
}
--
2.1.4
More information about the xorg-devel
mailing list