use safer p_clear when possible.
[apps/madmutt.git] / pager.c
diff --git a/pager.c b/pager.c
index 2a5cadf..2e4aa39 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -887,7 +887,7 @@ static int trim_incomplete_mbyte(unsigned char *buf, size_t len) {
   mbstate_t mbstate;
   size_t k;
 
-  memset (&mbstate, 0, sizeof (mbstate));
+  p_clear(&mbstate, 1);
   for (; len > 0; buf += k, len -= k) {
     k = mbrtowc (NULL, (char *) buf, len, &mbstate);
     if (k == -2) 
@@ -981,7 +981,7 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf,
     wrap_cols = COLS;
 
   /* FIXME: this should come from lineInfo */
-  memset (&mbstate, 0, sizeof (mbstate));
+  p_clear(&mbstate, 1);
 
   for (ch = 0, vch = 0; ch < cnt; ch += k, vch += k) {
     /* Handle ANSI sequences */
@@ -1146,7 +1146,7 @@ display_line (FILE * f, off_t *last_pos, struct line_t **lineInfo, int n,
   if (*last == *max) {
     p_realloc(lineInfo, *max += LINES);
     for (ch = *last; ch < *max; ch++) {
-      memset (&((*lineInfo)[ch]), 0, sizeof (struct line_t));
+      p_clear(&(*lineInfo)[ch], 1);
       (*lineInfo)[ch].type = -1;
       (*lineInfo)[ch].search_cnt = -1;
       (*lineInfo)[ch].syntax = p_new(struct syntax_t, 1);
@@ -1462,7 +1462,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t * extra)
 
   lineInfo = p_new(struct line_t, maxLine = LINES);
   for (i = 0; i < maxLine; i++) {
-    memset (&lineInfo[i], 0, sizeof (struct line_t));
+    p_clear(&lineInfo[i], 1);
     lineInfo[i].type = -1;
     lineInfo[i].search_cnt = -1;
     lineInfo[i].syntax = p_new(struct syntax_t, 1);