]> granicus.if.org Git - neomutt/commitdiff
Reduce variable scope - mutt/rfc2047.c
authorFederico Kircheis <federico.kircheis@gmail.com>
Mon, 5 Mar 2018 17:48:59 +0000 (18:48 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 6 Mar 2018 02:50:21 +0000 (02:50 +0000)
mutt/rfc2047.c

index 2e02c7ffd34995458fc1f699417834727ae7212f..9e62247eecebf6186643adbbfe5c3f3c72700aa2 100644 (file)
@@ -328,14 +328,13 @@ static size_t encode_block(char *str, char *buf, size_t buflen, const char *from
 static size_t choose_block(char *d, size_t dlen, int col, const char *fromcode,
                            const char *tocode, encoder_t *encoder, size_t *wlen)
 {
-  size_t n, nn;
-  int utf8 = fromcode && (mutt_str_strcasecmp(fromcode, "utf-8") == 0);
+  const int utf8 = fromcode && (mutt_str_strcasecmp(fromcode, "utf-8") == 0);
 
-  n = dlen;
+  size_t n = dlen;
   while (true)
   {
     assert(n > 0);
-    nn = try_block(d, n, fromcode, tocode, encoder, wlen);
+    const size_t nn = try_block(d, n, fromcode, tocode, encoder, wlen);
     if ((nn == 0) && ((col + *wlen) <= (ENCWORD_LEN_MAX + 1) || (n <= 1)))
       break;
     n = (nn ? nn : n) - 1;
@@ -442,7 +441,7 @@ static int rfc2047_encode(const char *d, size_t dlen, int col, const char *fromc
   size_t bufpos, buflen;
   char *u = NULL, *t0 = NULL, *t1 = NULL, *t = NULL;
   char *s0 = NULL, *s1 = NULL;
-  size_t ulen, r, n, wlen = 0;
+  size_t ulen, r, wlen = 0;
   encoder_t encoder;
   char *tocode1 = NULL;
   const char *tocode = NULL;
@@ -560,7 +559,7 @@ static int rfc2047_encode(const char *d, size_t dlen, int col, const char *fromc
   while (true)
   {
     /* Find how much we can encode. */
-    n = choose_block(t, t1 - t, col, icode, tocode, &encoder, &wlen);
+    size_t n = choose_block(t, t1 - t, col, icode, tocode, &encoder, &wlen);
     if (n == (t1 - t))
     {
       /* See if we can fit the us-ascii suffix, too. */