summaryrefslogtreecommitdiff
path: root/daemon/gvfsbackendftp.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2009-05-26 20:23:25 +0200
committerBenjamin Otte <otte@gnome.org>2009-05-26 20:48:13 +0200
commit586a4e0a2ca6d3c021e8eaf509fb689e0d398082 (patch)
tree6114f367895e37af839e28535d21554b2fce1c8d /daemon/gvfsbackendftp.c
parent0891475dd5cd3b6ff639d720f9e4f9d266874eea (diff)
downloadgvfs-586a4e0a2ca6d3c021e8eaf509fb689e0d398082.tar.gz
[FTP] clarify code
Don't use: if (error) /* error handling */ else /* normal code */; return; Instead use: if (error) { /* error handling */ return; } /* normal code */ return; This avoids lots of indentation for normal code and clarifies what the default flow of the code is.
Diffstat (limited to 'daemon/gvfsbackendftp.c')
-rw-r--r--daemon/gvfsbackendftp.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index 08d10aa7..7eec44b5 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -1625,55 +1625,55 @@ try_login:
{
ftp_connection_pop_job (conn);
ftp_connection_free (conn);
+ g_object_unref (addr);
+ return;
}
- else
- {
- if (prompt && !anonymous)
- {
- /* a prompt was created, so we have to save the password */
- g_vfs_keyring_save_password (ftp->user,
- g_network_address_get_hostname (addr),
- NULL,
- "ftp",
- NULL,
- NULL,
- port == 21 ? 0 : port,
- ftp->password,
- password_save);
- g_free (prompt);
- }
- mount_spec = g_mount_spec_new ("ftp");
- g_mount_spec_set (mount_spec, "host", g_network_address_get_hostname (addr));
- if (port != 21)
- {
- char *port_str = g_strdup_printf ("%u", port);
- g_mount_spec_set (mount_spec, "port", port_str);
- g_free (port_str);
- }
+ if (prompt && !anonymous)
+ {
+ /* a prompt was created, so we have to save the password */
+ g_vfs_keyring_save_password (ftp->user,
+ g_network_address_get_hostname (addr),
+ NULL,
+ "ftp",
+ NULL,
+ NULL,
+ port == 21 ? 0 : port,
+ ftp->password,
+ password_save);
+ g_free (prompt);
+ }
+
+ mount_spec = g_mount_spec_new ("ftp");
+ g_mount_spec_set (mount_spec, "host", g_network_address_get_hostname (addr));
+ if (port != 21)
+ {
+ char *port_str = g_strdup_printf ("%u", port);
+ g_mount_spec_set (mount_spec, "port", port_str);
+ g_free (port_str);
+ }
- if (ftp->has_initial_user)
- g_mount_spec_set (mount_spec, "user", ftp->user);
-
- if (g_str_equal (ftp->user, "anonymous"))
- display_name = g_strdup_printf (_("ftp on %s"), ftp->host_display_name);
- else
- {
- /* Translators: the first %s is the username, the second the host name */
- display_name = g_strdup_printf (_("ftp as %s on %s"), ftp->user, ftp->host_display_name);
- }
- g_vfs_backend_set_mount_spec (backend, mount_spec);
- g_mount_spec_unref (mount_spec);
+ if (ftp->has_initial_user)
+ g_mount_spec_set (mount_spec, "user", ftp->user);
+
+ if (g_str_equal (ftp->user, "anonymous"))
+ display_name = g_strdup_printf (_("ftp on %s"), ftp->host_display_name);
+ else
+ {
+ /* Translators: the first %s is the username, the second the host name */
+ display_name = g_strdup_printf (_("ftp as %s on %s"), ftp->user, ftp->host_display_name);
+ }
+ g_vfs_backend_set_mount_spec (backend, mount_spec);
+ g_mount_spec_unref (mount_spec);
- g_vfs_backend_set_display_name (backend, display_name);
- g_free (display_name);
- g_vfs_backend_set_icon_name (backend, "folder-remote");
+ g_vfs_backend_set_display_name (backend, display_name);
+ g_free (display_name);
+ g_vfs_backend_set_icon_name (backend, "folder-remote");
- ftp->connections = 1;
- ftp->max_connections = G_MAXUINT;
- ftp->queue = g_queue_new ();
- g_vfs_backend_ftp_push_connection (ftp, conn);
- }
+ ftp->connections = 1;
+ ftp->max_connections = G_MAXUINT;
+ ftp->queue = g_queue_new ();
+ g_vfs_backend_ftp_push_connection (ftp, conn);
g_object_unref (addr);
}