[PATCH] Simplify code in vnc_connection_open_host_interna



Hi,
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.
CHeers,
 -- Guido
>From 1441bac0c27759a0c1abef9b6a813c3b5cb90379 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx sigxcpu org>
Date: Tue, 7 Sep 2010 22:23:33 +0200
Subject: [PATCH] Simplify code in vnc_connection_open_host_internal

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 |   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;
 }
 
-- 
1.7.1



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