add errormessage and remove unneeded indention
Signed-off-by: Walter Harms <wha...@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 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel