[gmime: 3/8] minor code cleanup / variable renames



commit 8343aae99377a18121b586a70c2dcfc31337b091
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Mon Oct 30 15:12:36 2017 -0400

    minor code cleanup / variable renames

 gmime/gmime-application-pkcs7-mime.c |    2 +-
 gmime/gmime-autocrypt.c              |    4 ++--
 gmime/gmime-param.c                  |    6 +++---
 gmime/gmime-parser.c                 |    6 +++---
 gmime/gmime-utils.c                  |    7 ++-----
 5 files changed, 11 insertions(+), 14 deletions(-)
---
diff --git a/gmime/gmime-application-pkcs7-mime.c b/gmime/gmime-application-pkcs7-mime.c
index 15cb08d..29eebd6 100644
--- a/gmime/gmime-application-pkcs7-mime.c
+++ b/gmime/gmime-application-pkcs7-mime.c
@@ -170,7 +170,7 @@ g_mime_application_pkcs7_mime_new (GMimeSecureMimeType type)
                name = "smime.p7c";
                break;
        default:
-               g_assert_not_reached();
+               g_assert_not_reached ();
                break;
        }
        
diff --git a/gmime/gmime-autocrypt.c b/gmime/gmime-autocrypt.c
index 83296c0..92f1c13 100644
--- a/gmime/gmime-autocrypt.c
+++ b/gmime/gmime-autocrypt.c
@@ -780,8 +780,8 @@ g_mime_autocrypt_header_list_get_header_at (GMimeAutocryptHeaderList *acheaders,
 
        if (n < acheaders->array->len)
                return (GMimeAutocryptHeader*)(acheaders->array->pdata[n]);
-       else
-               return NULL;
+
+       return NULL;
 }
 
 /**
diff --git a/gmime/gmime-param.c b/gmime/gmime-param.c
index 67a2bbf..e1d8478 100644
--- a/gmime/gmime-param.c
+++ b/gmime/gmime-param.c
@@ -794,7 +794,7 @@ g_mime_param_list_encode (GMimeParamList *list, GMimeFormatOptions *options, gbo
                        /* we need to do special rfc2184 parameter wrapping */
                        size_t maxlen = GMIME_FOLD_LEN - (nlen + 6);
                        char *inend;
-                       int cnt = 0;
+                       int n = 0;
                        
                        inptr = value;
                        inend = value + vlen;
@@ -816,7 +816,7 @@ g_mime_param_list_encode (GMimeParamList *list, GMimeFormatOptions *options, gbo
                                                ptr = q;
                                }
                                
-                               if (cnt != 0) {
+                               if (n != 0) {
                                        g_string_append_c (str, ';');
                                        
                                        if (fold) {
@@ -830,7 +830,7 @@ g_mime_param_list_encode (GMimeParamList *list, GMimeFormatOptions *options, gbo
                                        used = 1;
                                }
                                
-                               g_string_append_printf (str, "%s*%d*=", param->name, cnt++);
+                               g_string_append_printf (str, "%s*%d*=", param->name, n++);
                                g_string_append_len (str, inptr, (size_t) (ptr - inptr));
                                used += (str->len - here);
                                
diff --git a/gmime/gmime-parser.c b/gmime/gmime-parser.c
index 1936bbb..70ae3e1 100644
--- a/gmime/gmime-parser.c
+++ b/gmime/gmime-parser.c
@@ -1391,11 +1391,11 @@ check_boundary (struct _GMimeParserPrivate *priv, const char *start, size_t len)
                
                /* check for OpenPGP markers... */
                for (i = 0; i < G_N_ELEMENTS (openpgp_markers); i++) {
-                       const char *this_marker = openpgp_markers[i].marker + 2;
+                       const char *pgp_marker = openpgp_markers[i].marker + 2;
                        openpgp_state_t state = openpgp_markers[i].before;
                        size_t n = openpgp_markers[i].len - 2;
                        
-                       if (len == n && priv->openpgp == state && !strncmp (this_marker, start, len))
+                       if (len == n && priv->openpgp == state && !strncmp (pgp_marker, start, len))
                                priv->openpgp = openpgp_markers[i].after;
                }
        }
@@ -1572,7 +1572,7 @@ parser_scan_mime_part_content (GMimeParser *parser, GMimePart *mime_part, Bounda
                start = parser_offset (priv, NULL);
        } else {
                stream = g_mime_stream_mem_new ();
-               start = len = 0;        /* values are unused, make compiler happy */
+               start = 0;
        }
        
        *found = parser_scan_content (parser, stream, &empty);
diff --git a/gmime/gmime-utils.c b/gmime/gmime-utils.c
index 1ac9edd..ddfe565 100644
--- a/gmime/gmime-utils.c
+++ b/gmime/gmime-utils.c
@@ -288,12 +288,9 @@ datetok (const char *date)
 static int
 decode_int (const char *in, size_t inlen)
 {
-       register const char *inptr;
+       register const char *inptr = in;
+       const char *inend = in + inlen;
        int val = 0;
-       const char *inend;
-       
-       inptr = in;
-       inend = in + inlen;
        
        while (inptr < inend) {
                if (!(*inptr >= '0' && *inptr <= '9'))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]