[gtk-vnc] Simplify logic in host open code



commit 35fbd3f214b2bb908dc97d762a3c31f3edacd595
Author: Guido Günther <agx sigxcpu org>
Date:   Wed Sep 8 14:31:17 2010 +0100

    Simplify logic in host open code
    
    The second else clause checks for conn_error != NULL twice and since we
    don't use it to determine the return value we can clear it
    unconditionally.
    
    * src/vncconnection.c: Simplify logic in vnc_connection_open_host_internal

 src/vncconnection.c |   13 +------------
 1 files changed, 1 insertions(+), 12 deletions(-)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index 8a0a6c3..e3835c9 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -4615,22 +4615,11 @@ static gboolean vnc_connection_open_host_internal(VncConnection *conn)
 		g_object_unref(sockaddr);
 	}
 	g_object_unref(enumerator);
+	g_clear_error(&conn_error);
 	if (sock) {
-		/* We couldn't connect to the first address, but we succeeded
-		 * in connecting to a later address.
-		 */
-		if (conn_error)
-			g_error_free (conn_error);
 		priv->sock = sock;
 		return TRUE;
-	} else if (conn_error) {
-		/* Either the initial lookup failed, or else the caller
-		 * cancelled us.
-		 */
-		if (conn_error)
-			g_error_free (conn_error);
 	}
-
 	return FALSE;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]