make code more readable.
[apps/madmutt.git] / smime.c
diff --git a/smime.c b/smime.c
index 554f02e..608d53b 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -16,6 +16,7 @@
 #include <lib-lib/mem.h>
 #include <lib-lib/str.h>
 #include <lib-lib/macros.h>
+#include <lib-lib/file.h>
 
 #include "mutt.h"
 #include "enter.h"
@@ -93,7 +94,7 @@ static char SmimeIntermediateToUse[_POSIX_PATH_MAX];
 
 void smime_void_passphrase (void)
 {
-  memset (SmimePass, 0, sizeof (SmimePass));
+  p_clear(SmimePass, sizeof(SmimePass));
   SmimeExptime = 0;
 }
 
@@ -266,7 +267,7 @@ static pid_t smime_invoke (FILE ** smimein, FILE ** smimeout,
   struct smime_command_context cctx;
   char cmd[HUGE_STRING];
 
-  memset (&cctx, 0, sizeof (cctx));
+  p_clear(&cctx, 1);
 
   if (!format || !*format)
     return (pid_t) - 1;
@@ -375,7 +376,7 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public)
   }
   fclose (index);
 
-  FOREVER {
+  for (;;) {
     *qry = 0;
     if (mutt_get_field (prompt, qry, sizeof (qry), 0))
       return NULL;
@@ -409,8 +410,8 @@ char *smime_ask_for_key (char *prompt, char *mailbox, short public)
 
       Table[cur].hash = hash;
       Table[cur].suffix = hash_suffix;
-      strncpy (Table[cur].email, fields[0], sizeof (Table[cur].email));
-      strncpy (Table[cur].nick, fields[2], sizeof (Table[cur].nick));
+      m_strcpy(Table[cur].email, sizeof(Table[cur].email), fields[0]);
+      m_strcpy(Table[cur].nick,  sizeof(Table[cur].nick),  fields[2]);
       Table[cur].trust = *fields[4];
       Table[cur].public = public;
 
@@ -1813,7 +1814,7 @@ int smime_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, BODY ** cur)
   if (b->parts)
     return -1;
 
-  memset (&s, 0, sizeof (s));
+  p_clear(&s, 1);
   s.fpin = fpin;
   fseeko (s.fpin, b->offset, 0);