]> granicus.if.org Git - neomutt/commitdiff
drop memset for simple arrays
authorRichard Russon <rich@flatcap.org>
Tue, 12 Jun 2018 13:06:07 +0000 (14:06 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 12 Jun 2018 13:43:28 +0000 (14:43 +0100)
alias.c
buffy.c
imap/auth_cram.c
mutt/file.c

diff --git a/alias.c b/alias.c
index 1104469304c85bfaef8f907ac3575e25e731271f..d93d7e9ae7e6e7df601f09266b0c287c648962ac 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -581,12 +581,10 @@ int mutt_alias_complete(char *buf, size_t buflen)
 {
   struct Alias *a = NULL, *tmp = NULL;
   struct AliasList a_list = TAILQ_HEAD_INITIALIZER(a_list);
-  char bestname[HUGE_STRING];
+  char bestname[HUGE_STRING] = { 0 };
 
   if (buf[0] != 0) /* avoid empty string as strstr argument */
   {
-    memset(bestname, 0, sizeof(bestname));
-
     TAILQ_FOREACH(a, &Aliases, entries)
     {
       if (a->name && strncmp(a->name, buf, strlen(buf)) == 0)
diff --git a/buffy.c b/buffy.c
index d60f3149af0dd2ad844efc377b44b73c00aaafa0..bb27513d32ef67f8eb0f675942d96fa533bddba2 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -68,10 +68,9 @@ static short BuffyNotify = 0; /**< # of unnotified new boxes */
 static int fseek_last_message(FILE *f)
 {
   LOFF_T pos;
-  char buffer[BUFSIZ + 9]; /* 7 for "\n\nFrom " */
+  char buffer[BUFSIZ + 9] = { 0 }; /* 7 for "\n\nFrom " */
   size_t bytes_read;
 
-  memset(buffer, 0, sizeof(buffer));
   fseek(f, 0, SEEK_END);
   pos = ftello(f);
 
index c7eea3df2304153290b984e7f9b546f91180ad4f..218406fdb0cd6c4e08627cf405b27e29d1e1689d 100644 (file)
@@ -51,7 +51,8 @@
 static void hmac_md5(const char *password, char *challenge, unsigned char *response)
 {
   struct Md5Ctx ctx;
-  unsigned char ipad[MD5_BLOCK_LEN], opad[MD5_BLOCK_LEN];
+  unsigned char ipad[MD5_BLOCK_LEN] = { 0 };
+  unsigned char opad[MD5_BLOCK_LEN] = { 0 };
   unsigned char secret[MD5_BLOCK_LEN + 1];
   size_t secret_len;
 
@@ -69,8 +70,6 @@ static void hmac_md5(const char *password, char *challenge, unsigned char *respo
   else
     mutt_str_strfcpy((char *) secret, password, sizeof(secret));
 
-  memset(ipad, 0, sizeof(ipad));
-  memset(opad, 0, sizeof(opad));
   memcpy(ipad, secret, secret_len);
   memcpy(opad, secret, secret_len);
 
index 96b6cf2efdc57439f9174b3438248090eeeb6c37..6cd7313e61b0a9c1cf6b78385e6be4f90e2eae5f 100644 (file)
@@ -217,8 +217,7 @@ void mutt_file_unlink(const char *s)
   if (f)
   {
     unlink(s);
-    char buf[2048];
-    memset(buf, 0, sizeof(buf));
+    char buf[2048] = { 0 };
     while (sb.st_size > 0)
     {
       fwrite(buf, 1, MIN(sizeof(buf), sb.st_size), f);