From: Pierre Habouzit Date: Fri, 25 May 2007 12:04:13 +0000 (+0200) Subject: simplifications. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=9d1d3eb0666af7f3f3551579601920f1bced8407;p=apps%2Fmadmutt.git simplifications. Signed-off-by: Pierre Habouzit --- diff --git a/lib-sys/mutt_socket.c b/lib-sys/mutt_socket.c index b90a1f2..b6ea846 100644 --- a/lib-sys/mutt_socket.c +++ b/lib-sys/mutt_socket.c @@ -33,18 +33,21 @@ /* support for multiple socket connections */ static CONNECTION *Connections = NULL; -/* forward declarations */ -static int socket_preconnect (void); -static int socket_connect (int fd, struct sockaddr *sa); -static CONNECTION *socket_new_conn (void); - /* Wrappers */ int mutt_socket_open (CONNECTION * conn) { - if (socket_preconnect ()) - return -1; + int rc; + + if (m_strlen(Preconnect)) { + rc = mutt_system (Preconnect); + if (rc) { + mutt_perror (_("Preconnect command failed.")); + mutt_sleep (1); + return -1; + } + } - return conn->conn_open (conn); + return conn->conn_open(conn); } int mutt_socket_close (CONNECTION * conn) @@ -214,10 +217,10 @@ CONNECTION *mutt_conn_find (const CONNECTION * start, const ACCOUNT * account) conn = conn->next; } - conn = socket_new_conn (); + conn = p_new(CONNECTION, 1); + conn->fd = -1; conn->account = *account; - - conn->next = Connections; + conn->next = Connections; Connections = conn; if (Tunnel && *Tunnel) @@ -237,25 +240,6 @@ CONNECTION *mutt_conn_find (const CONNECTION * start, const ACCOUNT * account) return conn; } -static int socket_preconnect (void) -{ - int rc; - int save_errno; - - if (m_strlen(Preconnect)) { - rc = mutt_system (Preconnect); - if (rc) { - save_errno = errno; - mutt_perror (_("Preconnect command failed.")); - mutt_sleep (1); - - return save_errno; - } - } - - return 0; -} - /* socket_connect: set up to connect to a socket fd. */ static int socket_connect (int fd, struct sockaddr *sa) { @@ -289,17 +273,6 @@ static int socket_connect (int fd, struct sockaddr *sa) return save_errno; } -/* socket_new_conn: allocate and initialise a new connection. */ -static CONNECTION *socket_new_conn (void) -{ - CONNECTION *conn; - - conn = p_new(CONNECTION, 1); - conn->fd = -1; - - return conn; -} - int raw_socket_close (CONNECTION * conn) { return close (conn->fd);