]> granicus.if.org Git - neomutt/commitdiff
cppcheck
authorRichard Russon <rich@flatcap.org>
Wed, 25 Jul 2018 13:23:50 +0000 (14:23 +0100)
committerRichard Russon <rich@flatcap.org>
Wed, 25 Jul 2018 14:08:29 +0000 (15:08 +0100)
handler.c
mutt_history.c
ncrypt/crypt_gpgme.c
send.c
test/config/address.c
test/config/bool.c
test/config/mbtable.c
test/config/quad.c
test/config/regex.c

index b1435bd81c73ba58dc666aedf74ac6ed2984e98c..599d3d616b0f24c66ebafa94506edb87edff7f08 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -775,12 +775,10 @@ static int external_body_handler(struct Body *b, struct State *s)
     if (s->flags & (MUTT_DISPLAY | MUTT_PRINTING))
     {
       char pretty_size[10];
-      long size = 0;
-
       char *length = mutt_param_get(&b->parameter, "length");
       if (length)
       {
-        size = strtol(length, NULL, 10);
+        long size = strtol(length, NULL, 10);
         mutt_str_pretty_size(pretty_size, sizeof(pretty_size), size);
         if (expire != -1)
         {
index a2fbad335f0878368f16b327c59b4eec1105a1db..4db61ba71b2350f8dec142a56251a1cea0ad6951 100644 (file)
@@ -102,14 +102,13 @@ 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 = NULL;
   int done = 0;
   char helpstr[LONG_STRING];
   char title[STRING];
 
   snprintf(title, sizeof(title), _("History '%s'"), buf);
 
-  menu = mutt_menu_new(MENU_GENERIC);
+  struct Menu *menu = mutt_menu_new(MENU_GENERIC);
   menu->make_entry = history_entry;
   menu->title = title;
   menu->help = mutt_compile_help(helpstr, sizeof(helpstr), MENU_GENERIC, HistoryHelp);
index 1cb10be73efa8695d80867fa7ff98dd965d3b189..3190193584e3905e5777667ef155c0c730d721d4 100644 (file)
@@ -689,11 +689,10 @@ static char *data_object_to_tempfile(gpgme_data_t data, FILE **ret_fp)
 {
   int err;
   char tempf[PATH_MAX];
-  FILE *fp = NULL;
   ssize_t nread = 0;
 
   mutt_mktemp(tempf, sizeof(tempf));
-  fp = mutt_file_fopen(tempf, "w+");
+  FILE *fp = mutt_file_fopen(tempf, "w+");
   if (!fp)
   {
     mutt_perror(_("Can't create temporary file"));
diff --git a/send.c b/send.c
index e291373feaa334b92962395547fb71473b11782f..0969ee07807d40993f9ba7a9342614833a9e3bcc 100644 (file)
--- a/send.c
+++ b/send.c
@@ -773,10 +773,9 @@ 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 = NULL;
   struct ListNode *np = NULL;
 
-  src = !STAILQ_EMPTY(&e->references) ? &e->references : &e->in_reply_to;
+  struct ListHead *src = !STAILQ_EMPTY(&e->references) ? &e->references : &e->in_reply_to;
   STAILQ_FOREACH(np, src, entries)
   {
     mutt_list_insert_tail(head, mutt_str_strdup(np->data));
index c47f5d92d1a3f863cddfcc3467c1f5fa6ecdf457..4550c97038a4d74d778f6da316a265caa5589e97 100644 (file)
@@ -346,11 +346,10 @@ static bool test_reset(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
 
   char *name = "Lemon";
-  char *addr = NULL;
 
   mutt_buffer_reset(err);
 
-  addr = VarLemon ? VarLemon->mailbox : NULL;
+  char *addr = VarLemon ? VarLemon->mailbox : NULL;
   printf("Initial: %s = '%s'\n", name, NONULL(addr));
   int rc = cs_str_string_set(cs, name, "hello@example.com", err);
   if (CSR_RESULT(rc) != CSR_SUCCESS)
index 4bbeb8f6001ce412021ca64b25877db9b66dee36..085b247a60113769de06fadd5bb6a1f1f309eee6 100644 (file)
@@ -583,7 +583,7 @@ static bool test_toggle(struct ConfigSet *cs, struct Buffer *err)
   {
     bool before = tests[i].before;
     bool after = tests[i].after;
-    printf("test %zd\n", i);
+    printf("test %zu\n", i);
 
     VarNectarine = before;
     mutt_buffer_reset(err);
@@ -619,7 +619,7 @@ static bool test_toggle(struct ConfigSet *cs, struct Buffer *err)
   {
     bool before = tests[i].before;
     bool after = tests[i].after;
-    printf("test %zd\n", i);
+    printf("test %zu\n", i);
 
     VarNectarine = before;
     mutt_buffer_reset(err);
index 89d8ee3a87e4f8ea3fde11455ca838c1a989b3d0..5c7d3fd814413d5898a1bf06f7604273b5e2e6b4 100644 (file)
@@ -362,11 +362,10 @@ static bool test_reset(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
 
   char *name = "Lemon";
-  char *mb = NULL;
 
   mutt_buffer_reset(err);
 
-  mb = VarLemon ? VarLemon->orig_str : NULL;
+  char *mb = VarLemon ? VarLemon->orig_str : NULL;
   printf("Initial: %s = '%s'\n", name, NONULL(mb));
   int rc = cs_str_string_set(cs, name, "hello", err);
   if (CSR_RESULT(rc) != CSR_SUCCESS)
index 732b00a02bdce97f5bfa783cb64de6ac2f13ffdc..68ad63b7210a0e443cd697be6ce053cb93da5ab9 100644 (file)
@@ -582,7 +582,7 @@ static bool test_toggle(struct ConfigSet *cs, struct Buffer *err)
   {
     char before = tests[i].before;
     char after = tests[i].after;
-    printf("test %zd\n", i);
+    printf("test %zu\n", i);
 
     VarNectarine = before;
     mutt_buffer_reset(err);
index 9727c90577e4d6d3fd0fa31f5d5a4add52db2db3..660a79a8201f9efc6ad48ad01cb8e344e3a317f4 100644 (file)
@@ -402,11 +402,10 @@ static bool test_reset(struct ConfigSet *cs, struct Buffer *err)
   log_line(__func__);
 
   char *name = "Mango";
-  char *regex = NULL;
 
   mutt_buffer_reset(err);
 
-  regex = VarMango ? VarMango->pattern : NULL;
+  char *regex = VarMango ? VarMango->pattern : NULL;
   printf("Initial: %s = '%s'\n", name, NONULL(regex));
   int rc = cs_str_string_set(cs, name, "hello.*", err);
   if (CSR_RESULT(rc) != CSR_SUCCESS)