]> granicus.if.org Git - neomutt/commitdiff
cocci checks
authorRichard Russon <rich@flatcap.org>
Wed, 11 Jul 2018 22:02:53 +0000 (23:02 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 16 Jul 2018 22:38:22 +0000 (23:38 +0100)
31 files changed:
alias.c
color.c
commands.c
compose.c
conn/ssl.c
copy.c
curs_main.c
email/parameter.c
email/tags.c
email/thread.c
handler.c
hcache/hcache.c
history.c
imap/imap.c
imap/message.c
init.c
maildir/mh.c
main.c
mutt/list.c
mutt/rfc2047.c
mutt_attach.c
mutt_thread.c
ncrypt/crypt_gpgme.c
ncrypt/pgpinvoke.c
ncrypt/smime.c
parse.c
pattern.c
remailer.c
rfc2231.c
send.c
sendlib.c

diff --git a/alias.c b/alias.c
index 5baf8dc1cb44df61787525751185085d260e732d..3388efc27b701529d259a9b56e632fa8795a4668 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -67,7 +67,7 @@ static struct Address *expand_aliases_r(struct Address *a, struct ListHead *expn
       if (t)
       {
         i = false;
-        struct ListNode *np;
+        struct ListNode *np = NULL;
         STAILQ_FOREACH(np, expn, entries)
         {
           if (mutt_str_strcmp(a->mailbox, np->data) == 0) /* alias already found */
diff --git a/color.c b/color.c
index 77c00ee4d9a44294ec8855ab3bba64c5ffe3d726..5ddbc03ae3f2d99b7af32e3fed71bd2e82dc893d 100644 (file)
--- a/color.c
+++ b/color.c
@@ -758,7 +758,7 @@ static int parse_object(struct Buffer *buf, struct Buffer *s, int *o, int *ql,
     if (*o == -1)
     {
       mutt_buffer_printf(err, _("%s: no such object"), buf->data);
-      return (-1);
+      return -1;
     }
   }
   else if ((*o = mutt_map_get_value(buf->data, Fields)) == -1)
index 66fae31986ec45debb118f6029971a5f3f126540..21db2d6856b552623deed9ca9317ca93570b342b 100644 (file)
@@ -1030,7 +1030,7 @@ int mutt_edit_content_type(struct Header *h, struct Body *b, FILE *fp)
   if (!TAILQ_EMPTY(&b->parameter))
   {
     size_t l = strlen(buf);
-    struct Parameter *np;
+    struct Parameter *np = NULL;
     TAILQ_FOREACH(np, &b->parameter, entries)
     {
       mutt_addr_cat(tmp, sizeof(tmp), np->value, MimeSpecials);
index c2fdc3b59fa5b6580175bedf4519fa262db2e195..b15c835b23ae560573aa567780ebf2b52f34d963 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -358,7 +358,7 @@ static void redraw_mix_line(struct ListHead *chain)
   }
 
   int c = 12;
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, chain, entries)
   {
     t = np->data;
index 2077444dbc4f946d679ab20397a187472c0cebfe..6294625cf275db5015617fd403665eb6cdba124b 100644 (file)
@@ -1307,7 +1307,7 @@ static int ssl_negotiate(struct Connection *conn, struct SslSockData *ssldata)
  */
 static int ssl_setup(struct Connection *conn)
 {
-  struct SslSockData *ssldata;
+  struct SslSockData *ssldata = NULL;
   int maxbits;
 
   ssldata = mutt_mem_calloc(1, sizeof(struct SslSockData));
diff --git a/copy.c b/copy.c
index 695778cf858baa0057f08fd0ca8c336e7514416b..fca860c0425ae48d9090ee04c73462fbce952fc6 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -162,7 +162,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end,
    */
   if (flags & CH_REORDER)
   {
-    struct ListNode *np;
+    struct ListNode *np = NULL;
     STAILQ_FOREACH(np, &HeaderOrderList, entries)
     {
       mutt_debug(3, "Reorder list: %s\n", np->data);
@@ -268,7 +268,7 @@ int mutt_copy_hdr(FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end,
       /* Find x -- the array entry where this header is to be saved */
       if (flags & CH_REORDER)
       {
-        struct ListNode *np;
+        struct ListNode *np = NULL;
         x = 0;
         STAILQ_FOREACH(np, &HeaderOrderList, entries)
         {
@@ -427,7 +427,7 @@ int mutt_copy_header(FILE *in, struct Header *h, FILE *out, int flags, const cha
   if ((flags & CH_UPDATE_IRT) && !STAILQ_EMPTY(&h->env->in_reply_to))
   {
     fputs("In-Reply-To:", out);
-    struct ListNode *np;
+    struct ListNode *np = NULL;
     STAILQ_FOREACH(np, &h->env->in_reply_to, entries)
     {
       fputc(' ', out);
index c70ec99b7be5579f36cb99202f3d0b649a473f08..17c9ec24b2344a655e717027a1d64973c9859b35 100644 (file)
@@ -1276,7 +1276,7 @@ int mutt_index_menu(void)
           /* trying to find msgid of the root message */
           if (op == OP_RECONSTRUCT_THREAD)
           {
-            struct ListNode *ref;
+            struct ListNode *ref = NULL;
             STAILQ_FOREACH(ref, &CURHDR->env->references, entries)
             {
               if (mutt_hash_find(Context->id_hash, ref->data) == NULL)
index 41e699813ddd9f3c96991f31ed90a9912a7b587f..e38bda6cfb5ece2f500c412fe23717f28600ec93 100644 (file)
@@ -83,7 +83,7 @@ char *mutt_param_get(const struct ParameterList *p, const char *s)
   if (!p)
     return NULL;
 
-  struct Parameter *np;
+  struct Parameter *np = NULL;
   TAILQ_FOREACH(np, p, entries)
   {
     if (mutt_str_strcasecmp(s, np->attribute) == 0)
@@ -115,7 +115,7 @@ void mutt_param_set(struct ParameterList *p, const char *attribute, const char *
     return;
   }
 
-  struct Parameter *np;
+  struct Parameter *np = NULL;
   TAILQ_FOREACH(np, p, entries)
   {
     if (mutt_str_strcasecmp(attribute, np->attribute) == 0)
@@ -141,7 +141,7 @@ void mutt_param_delete(struct ParameterList *p, const char *attribute)
   if (!p)
     return;
 
-  struct Parameter *np;
+  struct Parameter *np = NULL;
   TAILQ_FOREACH(np, p, entries)
   {
     if (mutt_str_strcasecmp(attribute, np->attribute) == 0)
index 72f29dab710aa4fda91bbb5fc741409f6667948c..5ba45fa532f51fe90c8e06cf2acf615e94f5b2f5 100644 (file)
@@ -55,7 +55,7 @@ static char *driver_tags_getter(struct TagHead *head, bool show_hidden,
     return NULL;
 
   char *tags = NULL;
-  struct TagNode *np;
+  struct TagNode *np = NULL;
   STAILQ_FOREACH(np, head, entries)
   {
     if (filter && mutt_str_strcmp(np->name, filter) != 0)
@@ -197,7 +197,7 @@ bool driver_tags_replace(struct TagHead *head, char *tags)
 
   if (tags)
   {
-    char *tag;
+    char *tag = NULL;
     while ((tag = strsep(&tags, " ")))
       driver_tags_add(head, tag);
     FREE(&tags);
index 27d02a7b3002545c6a4bff66d109c2b3a92cb4ff..5e2d81b46e7febae883f5f0702a6d701d51fb96e 100644 (file)
@@ -199,7 +199,7 @@ void clean_references(struct MuttThread *brk, struct MuttThread *cur)
       struct Header *h = cur->message;
 
       /* clearing the References: header from obsolete Message-ID(s) */
-      struct ListNode *np;
+      struct ListNode *np = NULL;
       while ((np = STAILQ_NEXT(ref, entries)) != NULL)
       {
         STAILQ_REMOVE_AFTER(&cur->message->env->references, ref, entries);
index 3d3c5c03b5b11c49ee94a4b67dde1a8b3368921f..f5cf6202f35cb2cdeec3a3551fdc1c8a63851242 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -485,7 +485,7 @@ static bool is_autoview(struct Body *b)
   {
     /* determine if this type is on the user's auto_view list */
     mutt_check_lookup_list(b, type, sizeof(type));
-    struct ListNode *np;
+    struct ListNode *np = NULL;
     STAILQ_FOREACH(np, &AutoViewList, entries)
     {
       int i = mutt_str_strlen(np->data) - 1;
@@ -943,7 +943,7 @@ static int alternative_handler(struct Body *a, struct State *s)
   a = b;
 
   /* First, search list of preferred types */
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, &AlternativeOrderList, entries)
   {
     int btlen; /* length of basetype */
index c31bcf5565cb86fa8e8aa545b8a1261dece7eddb..11ca90a26df3b360e0de1711c86a8fee47d29a66 100644 (file)
@@ -366,7 +366,7 @@ static unsigned char *dump_stailq(struct ListHead *l, unsigned char *d, int *off
 
   d = dump_int(0xdeadbeef, d, off);
 
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, l, entries)
   {
     d = dump_char(np->data, d, off, convert);
@@ -391,7 +391,7 @@ static void restore_stailq(struct ListHead *l, const unsigned char *d, int *off,
 
   restore_int(&counter, d, off);
 
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   while (counter)
   {
     np = mutt_list_insert_tail(l, NULL);
@@ -470,7 +470,7 @@ static unsigned char *dump_parameter(struct ParameterList *p, unsigned char *d,
 
   d = dump_int(0xdeadbeef, d, off);
 
-  struct Parameter *np;
+  struct Parameter *np = NULL;
   TAILQ_FOREACH(np, p, entries)
   {
     d = dump_char(np->attribute, d, off, false);
@@ -497,7 +497,7 @@ static void restore_parameter(struct ParameterList *p, const unsigned char *d,
 
   restore_int(&counter, d, off);
 
-  struct Parameter *np;
+  struct Parameter *np = NULL;
   while (counter)
   {
     np = mutt_param_new();
index 9bb79bb6c631488ab4765266b83f5595500482a8..ede1fb90ccf2cd36f05d22f1049dfeef537646e8 100644 (file)
--- a/history.c
+++ b/history.c
@@ -484,7 +484,7 @@ static void history_entry(char *buf, size_t buflen, struct Menu *menu, int num)
  */
 static void history_menu(char *buf, size_t buflen, char **matches, int match_count)
 {
-  struct Menu *menu;
+  struct Menu *menu = NULL;
   int done = 0;
   char helpstr[LONG_STRING];
   char title[STRING];
index 09713024af0c293e4cda84ed17245b7da039ca5e..d7d4bcfc9e380b62b6f6ba02bf7fcaf47c9d9e6a 100644 (file)
@@ -1145,7 +1145,7 @@ bool imap_has_flag(struct ListHead *flag_list, const char *flag)
   if (STAILQ_EMPTY(flag_list))
     return false;
 
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, flag_list, entries)
   {
     if (mutt_str_strncasecmp(np->data, flag, strlen(np->data)) == 0)
@@ -1251,7 +1251,7 @@ int imap_sync_message_for_copy(struct ImapData *idata, struct Header *hdr,
                                struct Buffer *cmd, int *err_continue)
 {
   char flags[LONG_STRING];
-  char *tags;
+  char *tags = NULL;
   char uid[11];
 
   if (!compare_flags_for_copy(hdr))
@@ -1597,7 +1597,7 @@ struct ImapStatus *imap_mboxcache_get(struct ImapData *idata, const char *mbox,
   void *uidnext = NULL;
 #endif
 
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, &idata->mboxcache, entries)
   {
     status = (struct ImapStatus *) np->data;
@@ -1654,7 +1654,7 @@ void imap_mboxcache_free(struct ImapData *idata)
 {
   struct ImapStatus *status = NULL;
 
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, &idata->mboxcache, entries)
   {
     status = (struct ImapStatus *) np->data;
@@ -2160,7 +2160,7 @@ static int imap_mbox_open(struct Context *ctx)
       mutt_debug(3, "No folder flags found\n");
     else
     {
-      struct ListNode *np;
+      struct ListNode *np = NULL;
       struct Buffer flag_buffer;
       mutt_buffer_init(&flag_buffer);
       mutt_buffer_printf(&flag_buffer, "Mailbox flags: ");
index 6683e95e6baff6e92b49b4e8288e982329f4066e..09881a04bd3f71aa70a7518d607567bd4336c315 100644 (file)
@@ -516,9 +516,9 @@ static void generate_seqset(struct Buffer *b, struct ImapData *idata,
 {
   int chunks = 0;
   int state = 0; /* 1: single msn, 2: range of msn */
-  unsigned int msn, range_begin, range_end;
+  unsigned int range_begin, range_end;
 
-  for (msn = msn_begin; msn <= msn_end + 1; msn++)
+  for (unsigned int msn = msn_begin; msn <= msn_end + 1; msn++)
   {
     if (msn <= msn_end && !idata->msn_index[msn - 1])
     {
diff --git a/init.c b/init.c
index 952b560264718b139f7eea1549571d0922df5ea8..f56f3f30855088bd731a8a96b4bbf2bd4cf38789 100644 (file)
--- a/init.c
+++ b/init.c
@@ -134,7 +134,7 @@ static void add_to_stailq(struct ListHead *head, const char *str)
     return;
 
   /* check to make sure the item is not already on this list */
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, head, entries)
   {
     if (mutt_str_strcasecmp(str, np->data) == 0)
@@ -387,7 +387,7 @@ static int execute_commands(struct ListHead *p)
   err.dsize = STRING;
   err.data = mutt_mem_malloc(err.dsize);
   mutt_buffer_init(&token);
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, p, entries)
   {
     if (mutt_parse_rc_line(np->data, &token, &err) == -1)
@@ -1022,7 +1022,7 @@ static void pretty_var(char *buf, size_t buflen, const char *option, const char
  */
 static int print_attach_list(struct ListHead *h, char op, char *name)
 {
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, h, entries)
   {
     printf("attachments %c%s %s/%s\n", op, name,
@@ -3943,7 +3943,7 @@ int mutt_init(bool skip_sys_rc, struct ListHead *commands)
   }
   else
   {
-    struct ListNode *np;
+    struct ListNode *np = NULL;
     STAILQ_FOREACH(np, &Muttrc, entries)
     {
       mutt_str_strfcpy(buffer, np->data, sizeof(buffer));
@@ -3998,7 +3998,7 @@ int mutt_init(bool skip_sys_rc, struct ListHead *commands)
   }
 
   /* Read the user's initialization file.  */
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, &Muttrc, entries)
   {
     if (np->data)
@@ -4361,7 +4361,7 @@ int mutt_query_variables(struct ListHead *queries)
   err.dsize = STRING;
   err.data = mutt_mem_malloc(err.dsize);
 
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, queries, entries)
   {
     snprintf(command, sizeof(command), "set ?%s\n", np->data);
index 7ef174ce5e2e87261ac5989c3eb09bb659f6d85d..82ac51b8c08bd06a3d98266cd165b7f387fb4b35 100644 (file)
@@ -2186,7 +2186,7 @@ int mh_sync_mailbox_message(struct Context *ctx, int msgno)
 #ifdef USE_HCACHE
       if (hc)
       {
-        const char *key;
+        const char *key = NULL;
         size_t keylen;
         if (ctx->magic == MUTT_MH)
         {
@@ -2234,7 +2234,7 @@ int mh_sync_mailbox_message(struct Context *ctx, int msgno)
 #ifdef USE_HCACHE
   if (hc && h->changed)
   {
-    const char *key;
+    const char *key = NULL;
     size_t keylen;
     if (ctx->magic == MUTT_MH)
     {
diff --git a/main.c b/main.c
index 6395cb23d91ac4a7003a19f4b02656a62ea7162f..ab1b0045fa51a7843342c20745ac748ac93de0c6 100644 (file)
--- a/main.c
+++ b/main.c
@@ -649,7 +649,7 @@ int main(int argc, char *argv[], char *envp[])
     struct Address *a = NULL;
     for (; optind < argc; optind++)
       mutt_list_insert_tail(&alias_queries, mutt_str_strdup(argv[optind]));
-    struct ListNode *np;
+    struct ListNode *np = NULL;
     STAILQ_FOREACH(np, &alias_queries, entries)
     {
       a = mutt_alias_lookup(np->data);
@@ -922,7 +922,7 @@ int main(int argc, char *argv[], char *envp[])
       while (a && a->next)
         a = a->next;
 
-      struct ListNode *np;
+      struct ListNode *np = NULL;
       STAILQ_FOREACH(np, &attach, entries)
       {
         if (a)
index 090f6d0d3731a4c35667cc9fa91174b0813f05e3..281568272483047a0f1fb948ebf1ff127049309d 100644 (file)
@@ -87,7 +87,7 @@ struct ListNode *mutt_list_insert_after(struct ListHead *h, struct ListNode *n,
  */
 struct ListNode *mutt_list_find(struct ListHead *h, const char *data)
 {
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, h, entries)
   {
     if (np->data == data || mutt_str_strcmp(np->data, data) == 0)
@@ -169,7 +169,7 @@ void mutt_list_clear(struct ListHead *h)
  */
 bool mutt_list_match(const char *s, struct ListHead *h)
 {
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, h, entries)
   {
     if ((*np->data == '*') || (mutt_str_strncasecmp(s, np->data, strlen(np->data)) == 0))
index 97c52168607b272411fc43f551912597d06fc78d..3cc8f58678fe1af460e93475f8adf8a5e5a17a74 100644 (file)
@@ -657,11 +657,11 @@ void mutt_rfc2047_decode(char **pd)
 
   struct Buffer buf = { 0 }; /* Output buffer                          */
   char *s = *pd;             /* Read pointer                           */
-  char *beg;                 /* Begin of encoded word                  */
+  char *beg = NULL;          /* Begin of encoded word                  */
   enum ContentEncoding enc;  /* ENCBASE64 or ENCQUOTEDPRINTABLE        */
-  char *charset;             /* Which charset                          */
+  char *charset = NULL;      /* Which charset                          */
   size_t charsetlen;         /* Length of the charset                  */
-  char *text;                /* Encoded text                           */
+  char *text = NULL;         /* Encoded text                           */
   size_t textlen;            /* Length of encoded text                 */
 
   /* Keep some state in case the next decoded word is using the same charset
@@ -714,7 +714,7 @@ void mutt_rfc2047_decode(char **pd)
       /* Some encoded text was found */
       text[textlen] = '\0';
       char *decoded = rfc2047_decode_word(text, textlen, enc);
-      if (decoded == NULL)
+      if (!decoded)
       {
         return;
       }
index 0c9d450e6cbb42935f1eb7fd34d016be7b3083cc..74078d27d9794fc24c7316b2b329984af1677ddf 100644 (file)
@@ -314,7 +314,7 @@ bailout:
  */
 void mutt_check_lookup_list(struct Body *b, char *type, size_t len)
 {
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, &MimeLookupList, entries)
   {
     const int i = mutt_str_strlen(np->data) - 1;
index 7fde461b35e780f1bc82bf659d94b374ef15418b..628e71185ed50347dd468497ff4b9fd1b511624c 100644 (file)
@@ -400,7 +400,7 @@ static void make_subject_list(struct ListHead *subjects, struct MuttThread *cur,
     env = cur->message->env;
     if (env->real_subj && ((env->real_subj != env->subject) || (!SortRe)))
     {
-      struct ListNode *np;
+      struct ListNode *np = NULL;
       STAILQ_FOREACH(np, subjects, entries)
       {
         rc = mutt_str_strcmp(env->real_subj, np->data);
@@ -441,7 +441,7 @@ static struct MuttThread *find_subject(struct Context *ctx, struct MuttThread *c
 
   make_subject_list(&subjects, cur, &date);
 
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, &subjects, entries)
   {
     for (ptr = mutt_hash_find_bucket(ctx->subj_hash, np->data); ptr; ptr = ptr->next)
index c5ed945802086dbdb7318c5622dc80693d4f95b8..0a0d7549fa40a892e09eaee69da8f9563f281055 100644 (file)
@@ -702,7 +702,7 @@ static char *data_object_to_tempfile(gpgme_data_t data, FILE **ret_fp)
 
 static void free_recipient_set(gpgme_key_t **p_rset)
 {
-  gpgme_key_t *rset;
+  gpgme_key_t *rset = NULL;
 
   if (!p_rset)
     return;
@@ -3896,7 +3896,7 @@ static char *list_to_pattern(struct ListHead *list)
   size_t n;
 
   n = 0;
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, list, entries)
   {
     for (s = np->data; *s; s++)
@@ -3982,7 +3982,7 @@ static struct CryptKeyInfo *get_candidates(struct ListHead *hints, unsigned int
          escaped pappert but simple strings passed in an array to the
          keylist_ext_start function. */
     size_t n = 0;
-    struct ListNode *np;
+    struct ListNode *np = NULL;
     STAILQ_FOREACH(np, hints, entries)
     {
       if (np->data && *np->data)
index 223da3a4be6e1b2819804b79def749a4c8d82542..17f16b9347bfe75d0eac97a41c6252c3260207c3 100644 (file)
@@ -366,7 +366,7 @@ pid_t pgp_invoke_list_keys(FILE **pgpin, FILE **pgpout, FILE **pgperr,
 
   *uids = '\0';
 
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, hints, entries)
   {
     mutt_file_quote_filename(quoted, sizeof(quoted), (char *) np->data);
index 94c922863581cb61b5fe57112b1fb1608377e122..6f6befcb2859fbf28b88a9d334b4a243006a892f 100644 (file)
@@ -1397,7 +1397,7 @@ struct Body *smime_class_build_smime_entity(struct Body *a, char *certlist)
   char buf[LONG_STRING], certfile[PATH_MAX];
   char tempfile[PATH_MAX];
   char smimeinfile[PATH_MAX];
-  char *cert_start, *cert_end;
+  char *cert_end = NULL;
   FILE *smimein = NULL;
   int err = 0, empty, off;
   pid_t thepid;
@@ -1431,7 +1431,7 @@ struct Body *smime_class_build_smime_entity(struct Body *a, char *certlist)
   }
 
   *certfile = '\0';
-  for (cert_start = certlist; cert_start; cert_start = cert_end)
+  for (char *cert_start = certlist; cert_start; cert_start = cert_end)
   {
     cert_end = strchr(cert_start, ' ');
     if (cert_end)
diff --git a/parse.c b/parse.c
index 280f2c2fd06fe38e23f54ad0a196e82ab9b49b95..585d30d79236fdab6bb6ad50bb82e66c38eeceb4 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -1350,7 +1350,7 @@ static bool count_body_parts_check(struct ListHead *checklist, struct Body *b, b
     return false;
   }
 
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, checklist, entries)
   {
     a = (struct AttachMatch *) np->data;
index 7d5d061b353057642ddd302a691f8c80bc1f34ec..da420f571508a7b30d3a570a33eb8d2bfd9e0a2b 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -1560,7 +1560,7 @@ static int match_addrlist(struct Pattern *pat, bool match_personal, int n, ...)
  */
 static bool match_reference(struct Pattern *pat, struct ListHead *refs)
 {
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, refs, entries)
   {
     if (patmatch(pat, np->data) == 0)
index 5bf5c590daf4eebfbcf3ae46b95aa07f9e16f479..6b4013690cd6ffa6df85464b12011fcb9d61f8d6 100644 (file)
@@ -512,7 +512,7 @@ void mix_make_chain(struct ListHead *chainhead)
 
   struct MixChain *chain = mutt_mem_calloc(1, sizeof(struct MixChain));
 
-  struct ListNode *p;
+  struct ListNode *p = NULL;
   STAILQ_FOREACH(p, chainhead, entries)
   {
     mix_chain_add(chain, p->data, type2_list);
@@ -764,7 +764,7 @@ int mix_send_message(struct ListHead *chain, const char *tempfile)
 
   snprintf(cmd, sizeof(cmd), "cat %s | %s -m ", tempfile, Mixmaster);
 
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, chain, entries)
   {
     mutt_str_strfcpy(tmp, cmd, sizeof(tmp));
index 17a55025120e088ae16626d3478501a77987963f..b945c73775b97a2662af5a85e8b79ba2a93c890e 100644 (file)
--- a/rfc2231.c
+++ b/rfc2231.c
@@ -161,7 +161,7 @@ static void rfc2231_join_continuations(struct ParameterList *p, struct Rfc2231Pa
     mutt_str_strfcpy(attribute, par->attribute, sizeof(attribute));
 
     const bool encoded = par->encoded;
-    char *valp;
+    char *valp = NULL;
     if (encoded)
       valp = rfc2231_get_charset(par->value, charset, sizeof(charset));
     else
diff --git a/send.c b/send.c
index 403ae4b13a644e6db93e0a918df2c0e405456f93..7e83d73938d34550509bd52901effb6c11686e1f 100644 (file)
--- a/send.c
+++ b/send.c
@@ -349,7 +349,7 @@ static int edit_envelope(struct Envelope *en, int flags)
     const char *p = NULL;
 
     buf[0] = 0;
-    struct ListNode *uh;
+    struct ListNode *uh = NULL;
     STAILQ_FOREACH(uh, &UserHeader, entries)
     {
       if (mutt_str_strncasecmp("subject:", uh->data, 8) == 0)
@@ -388,7 +388,7 @@ static char *nntp_get_header(const char *s)
 
 static void process_user_recips(struct Envelope *env)
 {
-  struct ListNode *uh;
+  struct ListNode *uh = NULL;
   STAILQ_FOREACH(uh, &UserHeader, entries)
   {
     if (mutt_str_strncasecmp("to:", uh->data, 3) == 0)
@@ -410,7 +410,7 @@ static void process_user_recips(struct Envelope *env)
 
 static void process_user_header(struct Envelope *env)
 {
-  struct ListNode *uh;
+  struct ListNode *uh = NULL;
   STAILQ_FOREACH(uh, &UserHeader, entries)
   {
     if (mutt_str_strncasecmp("from:", uh->data, 5) == 0)
@@ -697,8 +697,8 @@ int mutt_fetch_recips(struct Envelope *out, struct Envelope *in, int flags)
  */
 static void add_references(struct ListHead *head, struct Envelope *e)
 {
-  struct ListHead *src;
-  struct ListNode *np;
+  struct ListHead *src = NULL;
+  struct ListNode *np = NULL;
 
   src = !STAILQ_EMPTY(&e->references) ? &e->references : &e->in_reply_to;
   STAILQ_FOREACH(np, src, entries)
index c9df37ca6a13edf94004d6ec325e8f3213aaf863..b312b6a013e58820827bb21626c14bf841e13747 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -357,7 +357,7 @@ int mutt_write_mime_header(struct Body *a, FILE *f)
   {
     size_t len = 25 + mutt_str_strlen(a->subtype); /* approximate len. of content-type */
 
-    struct Parameter *np;
+    struct Parameter *np = NULL;
     TAILQ_FOREACH(np, &a->parameter, entries)
     {
       char *tmp = NULL;
@@ -1758,7 +1758,7 @@ void mutt_write_address_list(struct Address *addr, FILE *fp, int linelen, bool d
  */
 void mutt_write_references(const struct ListHead *r, FILE *f, size_t trim)
 {
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   size_t length = 0;
 
   STAILQ_FOREACH(np, r, entries)
@@ -2254,7 +2254,7 @@ int mutt_rfc822_write_header(FILE *fp, struct Envelope *env,
   }
 
   /* Add any user defined headers */
-  struct ListNode *tmp;
+  struct ListNode *tmp = NULL;
   STAILQ_FOREACH(tmp, &env->userhdrs, entries)
   {
     p = strchr(tmp->data, ':');
@@ -2308,7 +2308,7 @@ static void encode_headers(struct ListHead *h)
   char *p = NULL;
   int i;
 
-  struct ListNode *np;
+  struct ListNode *np = NULL;
   STAILQ_FOREACH(np, h, entries)
   {
     p = strchr(np->data, ':');
@@ -2851,7 +2851,7 @@ void mutt_prepare_envelope(struct Envelope *env, bool final)
  */
 void mutt_unprepare_envelope(struct Envelope *env)
 {
-  struct ListNode *item;
+  struct ListNode *item = NULL;
   STAILQ_FOREACH(item, &env->userhdrs, entries)
   {
     mutt_rfc2047_decode(&item->data);
@@ -3224,7 +3224,7 @@ int mutt_write_fcc(const char *path, struct Header *hdr, const char *msgid,
   if (post && !STAILQ_EMPTY(&hdr->chain))
   {
     fputs("X-Mutt-Mix:", msg->fp);
-    struct ListNode *p;
+    struct ListNode *p = NULL;
     STAILQ_FOREACH(p, &hdr->chain, entries)
     {
       fprintf(msg->fp, " %s", (char *) p->data);