pidgin: 1da27dec: Short circuit and return out of the func...

markdoliner at pidgin.im markdoliner at pidgin.im
Wed Mar 5 04:46:33 EST 2008


-----------------------------------------------------------------
Revision: 1da27deca963fa33f3fcef1c925867a8898129ec
Ancestor: d5ef30aafa0c0ecff773017ab7ac542f9ba7b4b4
Author: markdoliner at pidgin.im
Date: 2008-03-05T09:43:31
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1da27deca963fa33f3fcef1c925867a8898129ec

Modified files:
        libpurple/proxy.c

ChangeLog: 

Short circuit and return out of the function early if gconftool-2
isn't in our path.  This allows us to not indent the entire function.

-------------- next part --------------
============================================================
--- libpurple/proxy.c	9abf282dcfa5e1d8478ffd47ae6e200e87003af0
+++ libpurple/proxy.c	ece2c08402f8a7f9b92b00259301e1cd68b574c4
@@ -211,53 +211,53 @@ purple_gnome_proxy_get_info(void)
 purple_gnome_proxy_get_info(void)
 {
 	static PurpleProxyInfo info = {0, NULL, 0, NULL, NULL};
-	gchar *path;
-	if ((path = g_find_program_in_path("gconftool-2"))) {
-		gchar *tmp;
+	gchar *tmp;
 
-		g_free(path);
+	tmp = g_find_program_in_path("gconftool-2");
+	if (tmp == NULL)
+		return purple_global_proxy_get_info();
 
-		/* See whether to use a proxy. */
-		if (!g_spawn_command_line_sync("gconftool-2 -g /system/proxy/mode", &tmp,
-					       NULL, NULL, NULL))
-			return purple_global_proxy_get_info();
-		if (!strcmp(tmp, "none\n")) {
-			info.type = PURPLE_PROXY_NONE;
-			g_free(tmp);
-			return &info;
-		} else if (strcmp(tmp, "manual\n")) {
-			g_free(tmp);
-			return purple_global_proxy_get_info();
-		}
+	g_free(tmp);
 
+	/* See whether to use a proxy. */
+	if (!g_spawn_command_line_sync("gconftool-2 -g /system/proxy/mode", &tmp,
+				       NULL, NULL, NULL))
+		return purple_global_proxy_get_info();
+	if (!strcmp(tmp, "none\n")) {
+		info.type = PURPLE_PROXY_NONE;
 		g_free(tmp);
-		info.type = PURPLE_PROXY_HTTP;
+		return &info;
+	} else if (strcmp(tmp, "manual\n")) {
+		g_free(tmp);
+		return purple_global_proxy_get_info();
+	}
 
-		/* Get the new ones */
-		if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/host", &info.host,
-					       NULL, NULL, NULL))
-			return purple_global_proxy_get_info();
-		g_strchomp(info.host);
+	g_free(tmp);
+	info.type = PURPLE_PROXY_HTTP;
 
-		if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_user", &info.username,
-					       NULL, NULL, NULL))
-			return purple_global_proxy_get_info();
-		g_strchomp(info.username);
+	/* Get the new ones */
+	if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/host", &info.host,
+				       NULL, NULL, NULL))
+		return purple_global_proxy_get_info();
+	g_strchomp(info.host);
 
-		if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_password", &info.password,
-					       NULL, NULL, NULL))
-			return purple_global_proxy_get_info();
-		g_strchomp(info.password);
+	if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_user", &info.username,
+				       NULL, NULL, NULL))
+		return purple_global_proxy_get_info();
+	g_strchomp(info.username);
 
-		if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/port", &tmp,
-					       NULL, NULL, NULL))
-			return purple_global_proxy_get_info();
-		info.port = atoi(tmp);
-		g_free(tmp);
+	if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_password", &info.password,
+				       NULL, NULL, NULL))
+		return purple_global_proxy_get_info();
+	g_strchomp(info.password);
 
-		return &info;
-	}
-	return purple_global_proxy_get_info();
+	if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/port", &tmp,
+				       NULL, NULL, NULL))
+		return purple_global_proxy_get_info();
+	info.port = atoi(tmp);
+	g_free(tmp);
+
+	return &info;
 }
 /**************************************************************************
  * Proxy API


More information about the Commits mailing list