]> granicus.if.org Git - neomutt/commitdiff
Reduce variable scope - imap/command.c
authorFederico Kircheis <federico.kircheis@gmail.com>
Sat, 3 Mar 2018 08:35:31 +0000 (09:35 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 3 Mar 2018 12:33:02 +0000 (12:33 +0000)
imap/command.c

index bbde4d33c8268cf9c153e76684469fca0bdb166d..7fee52b8f5d0ad1226482c2c1934d6f06162f272 100644 (file)
@@ -133,20 +133,17 @@ static struct ImapCommand *cmd_new(struct ImapData *idata)
  */
 static int cmd_queue(struct ImapData *idata, const char *cmdstr, int flags)
 {
-  struct ImapCommand *cmd = NULL;
-  int rc;
-
   if (cmd_queue_full(idata))
   {
     mutt_debug(3, "Draining IMAP command pipeline\n");
 
-    rc = imap_exec(idata, NULL, IMAP_CMD_FAIL_OK | (flags & IMAP_CMD_POLL));
+    const int rc = imap_exec(idata, NULL, IMAP_CMD_FAIL_OK | (flags & IMAP_CMD_POLL));
 
     if (rc < 0 && rc != -2)
       return rc;
   }
 
-  cmd = cmd_new(idata);
+  struct ImapCommand *cmd = cmd_new(idata);
   if (!cmd)
     return IMAP_CMD_BAD;
 
@@ -636,8 +633,6 @@ static void cmd_parse_status(struct ImapData *idata, char *s)
   char *value = NULL;
   struct Buffy *inc = NULL;
   struct ImapMbox mx;
-  unsigned long ulcount;
-  unsigned int count;
   struct ImapStatus *status = NULL;
   unsigned int olduv, oldun;
   unsigned int litlen;
@@ -681,13 +676,13 @@ static void cmd_parse_status(struct ImapData *idata, char *s)
     value = imap_next_word(s);
 
     errno = 0;
-    ulcount = strtoul(value, &value, 10);
+    const unsigned long ulcount = strtoul(value, &value, 10);
     if (((errno == ERANGE) && (ulcount == ULONG_MAX)) || ((unsigned int) ulcount != ulcount))
     {
       mutt_debug(1, "Error parsing STATUS number\n");
       return;
     }
-    count = (unsigned int) ulcount;
+    const unsigned int count = (unsigned int) ulcount;
 
     if (mutt_str_strncmp("MESSAGES", s, 8) == 0)
     {