]> granicus.if.org Git - neomutt/commitdiff
Reduce variable scope - smtp.c
authorFederico Kircheis <federico.kircheis@gmail.com>
Wed, 7 Mar 2018 17:31:03 +0000 (18:31 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 8 Mar 2018 02:27:15 +0000 (02:27 +0000)
smtp.c

diff --git a/smtp.c b/smtp.c
index d772df1ae99f7e4bf710d55c4813cdd3bb60285c..1d7c70b4fa4a50655bc3f98ffbfbb1af6158e6f6 100644 (file)
--- a/smtp.c
+++ b/smtp.c
@@ -278,17 +278,13 @@ static bool addresses_use_unicode(const struct Address *a)
 
 static int smtp_fill_account(struct Account *account)
 {
-  static unsigned short SmtpPort = 0;
-
-  struct servent *service = NULL;
   struct Url url;
-  char *urlstr = NULL;
 
   account->flags = 0;
   account->port = 0;
   account->type = MUTT_ACCT_TYPE_SMTP;
 
-  urlstr = mutt_str_strdup(SmtpUrl);
+  char *urlstr = mutt_str_strdup(SmtpUrl);
   url_parse(&url, urlstr);
   if ((url.scheme != U_SMTP && url.scheme != U_SMTPS) || !url.host ||
       mutt_account_fromurl(account, &url) < 0)
@@ -311,9 +307,10 @@ static int smtp_fill_account(struct Account *account)
       account->port = SMTPS_PORT;
     else
     {
+      static unsigned short SmtpPort = 0;
       if (!SmtpPort)
       {
-        service = getservbyname("smtp", "tcp");
+        struct servent *service = getservbyname("smtp", "tcp");
         if (service)
           SmtpPort = ntohs(service->s_port);
         else