]> granicus.if.org Git - mutt/commitdiff
As the ones of you who compile with new gcc's probably have noticed,
authorMads Martin Joergensen <mmj@suse.de>
Fri, 19 Sep 2003 13:03:25 +0000 (13:03 +0000)
committerMads Martin Joergensen <mmj@suse.de>
Fri, 19 Sep 2003 13:03:25 +0000 (13:03 +0000)
there's a lot of type-punning in Mutt. With help from Philipp
Thomas, I've fixed all I could find in CVS (please double-check, one
might have slipped through the cracks), I can make one for 1.4 CVS
branch as well if wanted.

31 files changed:
addrbook.c
browser.c
color.c
compose.c
copy.c
crypt.c
curs_lib.c
edit.c
enter.c
handler.c
imap/browse.c
imap/command.c
lib.c
lib.h
mh.c
mutt_idna.c
mx.c
pager.c
parse.c
pgp.c
pgpkey.c
pop_lib.c
query.c
recvattach.c
remailer.c
rfc1524.c
rfc2047.c
rfc2231.c
sendlib.c
smime.c
thread.c

index 54a9242859308142e70bf0276ad955d9fa275a5e..08bed176513939f2e0ad2e1f8c75223e81e32667 100644 (file)
@@ -164,7 +164,7 @@ new_aliases:
     menu->max++;
   }
 
-  safe_realloc ((void **) &AliasTable, menu->max * sizeof (ALIAS *));
+  safe_realloc (&AliasTable, menu->max * sizeof (ALIAS *));
   menu->data = AliasTable;
 
   for (i = omax, aliasp = aliases; aliasp; aliasp = aliasp->next, i++)
index 1ee315f0ed25e198580c4961eb44673a390f2a74..f60295b95acb5e4a35eda1dafb8f0b1b00bd16fc 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -307,7 +307,7 @@ static void add_folder (MUTTMENU *m, struct browser_state *state,
   if (state->entrylen == state->entrymax)
   {
     /* need to allocate more space */
-    safe_realloc ((void **) &state->entry,
+    safe_realloc (&state->entry,
                  sizeof (struct folder_file) * (state->entrymax += 256));
     memset (&state->entry[state->entrylen], 0,
            sizeof (struct folder_file) * 256);
diff --git a/color.c b/color.c
index 134818a5fabcb9dca5858440078479392feef94a..2d013e734c86cb7a074bd9d7f2ca98773200e92c 100644 (file)
--- a/color.c
+++ b/color.c
@@ -737,7 +737,7 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err,
   {
     if (q_level >= ColorQuoteSize)
     {
-      safe_realloc ((void **) &ColorQuote, (ColorQuoteSize += 2) * sizeof (int));
+      safe_realloc (&ColorQuote, (ColorQuoteSize += 2) * sizeof (int));
       ColorQuote[ColorQuoteSize-2] = ColorDefs[MT_COLOR_QUOTED];
       ColorQuote[ColorQuoteSize-1] = ColorDefs[MT_COLOR_QUOTED];
     }
index 8160b26290361e05414a8d015c5be2d459de0f1a..22ebc23c239e636c1b91d405702a1903d886a3bc 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -753,7 +753,7 @@ int mutt_compose_menu (HEADER *msg,   /* structure for new message */
           break;       
        if (idxlen == idxmax)
         {
-         safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5));
+         safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5));
          menu->data = idx;
        }
        
@@ -800,7 +800,7 @@ int mutt_compose_menu (HEADER *msg,   /* structure for new message */
 
          if (idxlen + numfiles >= idxmax)
          {
-           safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5 + numfiles));
+           safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5 + numfiles));
            menu->data = idx;
          }
 
@@ -899,7 +899,7 @@ int mutt_compose_menu (HEADER *msg,   /* structure for new message */
 
          if (idxlen + Context->tagged >= idxmax)
          {
-           safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5 + Context->tagged));
+           safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5 + Context->tagged));
            menu->data = idx;
          }
 
@@ -1168,7 +1168,7 @@ int mutt_compose_menu (HEADER *msg,   /* structure for new message */
          }
          if (idxlen == idxmax)
          {
-           safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5));
+           safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5));
            menu->data = idx;
          }
 
diff --git a/copy.c b/copy.c
index 3d814febe7757e488512e6fd23619fcac5a0b618..2bfcde7fb3f2c42c2f40f4462def85dca523f8bd 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -150,7 +150,7 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
          headers[x] = this_one;
        else 
        {
-         safe_realloc ((void **) &headers[x], mutt_strlen (headers[x]) + 
+         safe_realloc (&headers[x], mutt_strlen (headers[x]) + 
                        mutt_strlen (this_one) + sizeof (char));
          strcat (headers[x], this_one); /* __STRCAT_CHECKED__ */
          FREE (&this_one);
@@ -217,7 +217,7 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
        this_one = safe_strdup (buf);
       else
       {
-       safe_realloc ((void **) &this_one, 
+       safe_realloc (&this_one,
                      mutt_strlen (this_one) + mutt_strlen (buf) + sizeof (char));
        strcat (this_one, buf); /* __STRCAT_CHECKED__ */
       }
@@ -237,7 +237,7 @@ mutt_copy_hdr (FILE *in, FILE *out, long off_start, long off_end, int flags,
       headers[x] = this_one;
     else 
     {
-      safe_realloc ((void **) &headers[x], mutt_strlen (headers[x]) + 
+      safe_realloc (&headers[x], mutt_strlen (headers[x]) + 
                    mutt_strlen (this_one) + sizeof (char));
       strcat (headers[x], this_one); /* __STRCAT_CHECKED__ */
       FREE (&this_one);
@@ -795,7 +795,7 @@ static void format_address_header (char **h, ADDRESS *a)
   buflen  = linelen + 3;
   
   
-  safe_realloc ((void **) h, buflen);
+  safe_realloc (h, buflen);
   for (count = 0; a; a = a->next, count++)
   {
     ADDRESS *tmp = a->next;
@@ -827,7 +827,7 @@ static void format_address_header (char **h, ADDRESS *a)
     }
     
     buflen += l + mutt_strlen (cbuf) + mutt_strlen (c2buf);
-    safe_realloc ((void **) h, buflen);
+    safe_realloc (h, buflen);
     strcat (*h, cbuf);         /* __STRCAT_CHECKED__ */
     strcat (*h, buf);          /* __STRCAT_CHECKED__ */
     strcat (*h, c2buf);                /* __STRCAT_CHECKED__ */
diff --git a/crypt.c b/crypt.c
index 72f775dd07354d1d2e411fec85023dd396890d49..6bca40dd747ffe72f3954b6e97ac80eadb6d09a2 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -766,7 +766,7 @@ static void crypt_fetch_signatures (BODY ***signatures, BODY *a, int *n)
     else
     {
       if((*n % 5) == 0)
-       safe_realloc ((void **) signatures, (*n + 6) * sizeof (BODY **));
+       safe_realloc (signatures, (*n + 6) * sizeof (BODY **));
 
       (*signatures)[(*n)++] = a;
     }
index ff97d316b2d05d854c932b427ba2a14d7dd74fa3..28fd0ae72325ce0c69d79722f28ac362ddca08a9 100644 (file)
@@ -452,7 +452,7 @@ void mutt_ungetch (int ch, int op)
   tmp.op = op;
 
   if (UngetCount >= UngetBufLen)
-    safe_realloc ((void **) &KeyEvent, (UngetBufLen += 128) * sizeof(event_t));
+    safe_realloc (&KeyEvent, (UngetBufLen += 128) * sizeof(event_t));
 
   KeyEvent[UngetCount++] = tmp;
 }
diff --git a/edit.c b/edit.c
index 77472910d12770113d02060437a885a33044ffc8..e29cb6691efaa61ef4e6bc1b5c25900361bcc03a 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -77,11 +77,11 @@ be_snarf_data (FILE *f, char **buf, int *bufmax, int *buflen, int offset,
     if (fgets (p, tmplen - 1, f) == NULL) break;
     bytes -= mutt_strlen (p);
     if (*bufmax == *buflen)
-      safe_realloc ((void **)&buf, sizeof (char *) * (*bufmax += 25));
+      safe_realloc (&buf, sizeof (char *) * (*bufmax += 25));
     buf[(*buflen)++] = safe_strdup (tmp);
   }
   if (buf && *bufmax == *buflen) { /* Do not smash memory past buf */
-    safe_realloc ((void **)&buf, sizeof (char *) * (++*bufmax));
+    safe_realloc (&buf, sizeof (char *) * (++*bufmax));
   }
   if (buf) buf[*buflen] = NULL;
   return (buf);
@@ -160,7 +160,7 @@ be_include_messages (char *msg, char **buf, int *bufmax, int *buflen,
       }
 
       if (*bufmax == *buflen)
-       safe_realloc ((void **) &buf, sizeof (char *) * (*bufmax += 25));
+       safe_realloc ( &buf, sizeof (char *) * (*bufmax += 25));
       buf[(*buflen)++] = safe_strdup (tmp);
 
       bytes = Context->hdrs[n]->content->length;
@@ -175,7 +175,7 @@ be_include_messages (char *msg, char **buf, int *bufmax, int *buflen,
                           pfx);
 
       if (*bufmax == *buflen)
-       safe_realloc ((void **)&buf, sizeof (char *) * (*bufmax += 25));
+       safe_realloc (&buf, sizeof (char *) * (*bufmax += 25));
       buf[(*buflen)++] = safe_strdup ("\n");
     }
     else
@@ -465,7 +465,7 @@ int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur)
     {
       strncat (tmp, "\n", sizeof(tmp)); tmp[sizeof(tmp) - 1] = '\0';
       if (buflen == bufmax)
-       safe_realloc ((void **)&buf, sizeof (char *) * (bufmax += 25));
+       safe_realloc (&buf, sizeof (char *) * (bufmax += 25));
       buf[buflen++] = safe_strdup (tmp[1] == '~' ? tmp + 1 : tmp);
     }
     
diff --git a/enter.c b/enter.c
index bd436ba5c0c34b39d5a9c6060aee686946172544..9547ebb8f000e56001597d0fc2b4ef90917cc6f4 100644 (file)
--- a/enter.c
+++ b/enter.c
@@ -132,7 +132,7 @@ size_t my_mbstowcs (wchar_t **pwbuf, size_t *pwbuflen, size_t i, char *buf)
     if (i >= wbuflen)
     {
       wbuflen = i + 20;
-      safe_realloc ((void **) &wbuf, wbuflen * sizeof (*wbuf));
+      safe_realloc (&wbuf, wbuflen * sizeof (*wbuf));
     }
     wbuf[i++] = wc;
   }
@@ -158,7 +158,7 @@ static void replace_part (ENTER_STATE *state, size_t from, char *buf)
   if (state->curpos + savelen > state->wbuflen)
   {
     state->wbuflen = state->curpos + savelen;
-    safe_realloc ((void **) &state->wbuf, state->wbuflen * sizeof (wchar_t));
+    safe_realloc (&state->wbuf, state->wbuflen * sizeof (wchar_t));
   }
 
   /* Restore suffix */
@@ -473,7 +473,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
            if (!mutt_complete (buf, buflen))
            {
              templen = state->lastchar - i;
-             safe_realloc ((void **) &tempbuf, templen * sizeof (wchar_t));
+             safe_realloc (&tempbuf, templen * sizeof (wchar_t));
            }
            else
              BEEP ();
@@ -538,7 +538,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
            if (!mutt_complete (buf, buflen))
            {
              templen = state->lastchar;
-             safe_realloc ((void **) &tempbuf, templen * sizeof (wchar_t));
+             safe_realloc (&tempbuf, templen * sizeof (wchar_t));
              memcpy (tempbuf, state->wbuf, templen * sizeof (wchar_t));
            }
            else
@@ -671,7 +671,7 @@ self_insert:
        if (state->lastchar >= state->wbuflen)
        {
          state->wbuflen = state->lastchar + 20;
-         safe_realloc ((void **) &state->wbuf, state->wbuflen * sizeof (wchar_t));
+         safe_realloc (&state->wbuf, state->wbuflen * sizeof (wchar_t));
        }
        memmove (state->wbuf + state->curpos + 1, state->wbuf + state->curpos, (state->lastchar - state->curpos) * sizeof (wchar_t));
        state->wbuf[state->curpos++] = wc;
index 49bba437d9b6b2d3237d83d3ad092bf982abcd05..850405951b6c5f5b2c69eb11b0be67d7b8260da4 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -587,7 +587,7 @@ static void enriched_flush (struct enriched_state *stte, int wrap)
     if (stte->line_used > stte->line_max)
     {
       stte->line_max = stte->line_used;
-      safe_realloc ((void **) &stte->line, stte->line_max + 1);
+      safe_realloc (&stte->line, stte->line_max + 1);
     }
     strcat (stte->line, stte->buffer); /* __STRCAT_CHECKED__ */
     stte->line_len += stte->word_len;
@@ -606,7 +606,7 @@ static void enriched_putc (int c, struct enriched_state *stte)
     if (stte->tag_level[RICH_COLOR]) 
     {
       if (stte->param_used + 1 >= stte->param_len)
-       safe_realloc ((void **) &stte->param, (stte->param_len += STRING));
+       safe_realloc (&stte->param, (stte->param_len += STRING));
 
       stte->param[stte->param_used++] = c;
     }
@@ -617,7 +617,7 @@ static void enriched_putc (int c, struct enriched_state *stte)
   if (stte->buff_len < stte->buff_used + 3)
   {
     stte->buff_len += LONG_STRING;
-    safe_realloc ((void **) &stte->buffer, stte->buff_len + 1);
+    safe_realloc (&stte->buffer, stte->buff_len + 1);
   }
 
   if ((!stte->tag_level[RICH_NOFILL] && ISSPACE (c)) || c == '\0' )
@@ -673,7 +673,7 @@ static void enriched_puts (char *s, struct enriched_state *stte)
   if (stte->buff_len < stte->buff_used + mutt_strlen(s))
   {
     stte->buff_len += LONG_STRING;
-    safe_realloc ((void **) &stte->buffer, stte->buff_len + 1);
+    safe_realloc (&stte->buffer, stte->buff_len + 1);
   }
   c = s;
   while (*c)
index 4300995736ce192d6a787bcb6664af3a3bdf1ad9..4a43420ca217cf8d23d7ea3d1285c4c54df7ce66 100644 (file)
@@ -357,7 +357,7 @@ static void imap_add_folder (char delim, char *folder, int noselect,
 
   if (state->entrylen + 1 == state->entrymax)
   {
-    safe_realloc ((void **) &state->entry,
+    safe_realloc (&state->entry,
       sizeof (struct folder_file) * (state->entrymax += 256));
     memset (state->entry + state->entrylen, 0,
       (sizeof (struct folder_file) * (state->entrymax - state->entrylen)));
index 214c281c4646ba6c152e6b8c0275409734699fa7..47cd3edfe53345a4b2c639d0b645e628b4c6c9dd 100644 (file)
@@ -105,7 +105,7 @@ int imap_cmd_step (IMAP_DATA* idata)
   {
     if (len == cmd->blen)
     {
-      safe_realloc ((void**) &cmd->buf, cmd->blen + IMAP_CMD_BUFSIZE);
+      safe_realloc (&cmd->buf, cmd->blen + IMAP_CMD_BUFSIZE);
       cmd->blen = cmd->blen + IMAP_CMD_BUFSIZE;
       dprint (3, (debugfile, "imap_cmd_step: grew buffer to %u bytes\n",
                  cmd->blen));
@@ -129,7 +129,7 @@ int imap_cmd_step (IMAP_DATA* idata)
   /* don't let one large string make cmd->buf hog memory forever */
   if ((cmd->blen > IMAP_CMD_BUFSIZE) && (len <= IMAP_CMD_BUFSIZE))
   {
-    safe_realloc ((void**) &cmd->buf, IMAP_CMD_BUFSIZE);
+    safe_realloc (&cmd->buf, IMAP_CMD_BUFSIZE);
     cmd->blen = IMAP_CMD_BUFSIZE;
     dprint (3, (debugfile, "imap_cmd_step: shrank buffer to %u bytes\n", cmd->blen));
   }
diff --git a/lib.c b/lib.c
index aeece74e6d6ed83d7aba2cf13b237b6973070338..97879c9878d098273c90c79c5d645ac92fae4f32 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -86,9 +86,10 @@ void *safe_malloc (size_t siz)
   return (p);
 }
 
-void safe_realloc (void **p, size_t siz)
+void safe_realloc (void *ptr, size_t siz)
 {
   void *r;
+  void **p = (void **)ptr;
 
   if (siz == 0)
   {
@@ -118,8 +119,9 @@ void safe_realloc (void **p, size_t siz)
   *p = r;
 }
 
-void safe_free (void **p)
+void safe_free (void *ptr)
 {
+  void **p = (void **)ptr;
   if (*p)
   {
     free (*p);                         /* __MEM_CHECKED__ */
@@ -160,7 +162,7 @@ void mutt_str_replace (char **p, const char *s)
 void mutt_str_adjust (char **p)
 {
   if (!p || !*p) return;
-  safe_realloc ((void **) p, strlen (*p) + 1);
+  safe_realloc (p, strlen (*p) + 1);
 }
 
 /* convert all characters in the string to lowercase */
@@ -492,7 +494,7 @@ char *mutt_read_line (char *s, size_t *size, FILE *fp, int *line)
         /* There wasn't room for the line -- increase ``s'' */
         offset = *size - 1; /* overwrite the terminating 0 */
         *size += STRING;
-        safe_realloc ((void **) &s, *size);
+        safe_realloc (&s, *size);
       }
     }
   }
diff --git a/lib.h b/lib.h
index d38a5f784c6510141c9ff008e9a95bacd66b502e..6e0068366eb03af975ef8113abfa7557a66c2bff 100644 (file)
--- a/lib.h
+++ b/lib.h
@@ -76,7 +76,7 @@
 # define MUTT_FORMAT2(a,b)     _MUTT_FORMAT_1(a, b)
 
 
-# define FREE(x) safe_free((void **)x)
+# define FREE(x) safe_free(x)
 # define NONULL(x) x?x:""
 # define ISSPACE(c) isspace((unsigned char)c)
 # define strfcpy(A,B,C) strncpy(A,B,C), *(A+(C)-1)=0
@@ -143,7 +143,7 @@ void mutt_sanitize_filename (char *, short);
 void mutt_str_replace (char **p, const char *s);
 void mutt_str_adjust (char **p);
 void mutt_unlink (const char *);
-void safe_free (void **);
-void safe_realloc (void **, size_t);
+void safe_free (void *);
+void safe_realloc (void *, size_t);
 
 #endif
diff --git a/mh.c b/mh.c
index ab4844fda3d4bf0a0cfd7926de2aaecf1a96b4fa..79ef88e76d5fadbe73734a5b37306a509910d1ba 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -70,8 +70,7 @@ static void mhs_alloc (struct mh_sequences *mhs, int i)
   if (i > mhs->max || !mhs->flags)
   {
     newmax = i + 128;
-    safe_realloc ((void **) &mhs->flags,
-                 sizeof (mhs->flags[0]) * (newmax + 1));
+    safe_realloc (&mhs->flags, sizeof (mhs->flags[0]) * (newmax + 1));
     for (j = mhs->max + 1; j <= newmax; j++)
       mhs->flags[j] = 0;
 
index b6d3140ed678d399a09b32d247bc7440e9d0b096..6c0cc24c638cd97ef507c67581ba23706e512ffe 100644 (file)
@@ -157,7 +157,7 @@ int mutt_addrlist_to_idna (ADDRESS *a, char **err)
     }
     else
     {
-      safe_realloc ((void **) &a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2);
+      safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2);
       sprintf (a->mailbox, "%s@%s", NONULL(user), NONULL(tmp)); /* __SPRINTF_CHECKED__ */
     }
     
@@ -186,7 +186,7 @@ int mutt_addrlist_to_local (ADDRESS *a)
     
     if (mutt_idna_to_local (domain, &tmp, 0) == 0)
     {
-      safe_realloc ((void **) &a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2);
+      safe_realloc (&a->mailbox, mutt_strlen (user) + mutt_strlen (tmp) + 2);
       sprintf (a->mailbox, "%s@%s", NONULL (user), NONULL (tmp)); /* __SPRINTF_CHECKED__ */
     }
     
@@ -220,7 +220,7 @@ const char *mutt_addr_for_display (ADDRESS *a)
     return a->mailbox;
   }
   
-  safe_realloc ((void **) &buff, mutt_strlen (tmp) + mutt_strlen (user) + 2);
+  safe_realloc (&buff, mutt_strlen (tmp) + mutt_strlen (user) + 2);
   sprintf (buff, "%s@%s", NONULL(user), NONULL(tmp)); /* __SPRINTF_CHECKED__ */
   FREE (&tmp);
   FREE (&user);
diff --git a/mx.c b/mx.c
index 8b8c96f2e83b5bb7142f25169fa9b59e40e44734..41b2fcbfb5750c06989ce7d615321e64b3db059b 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -1539,8 +1539,8 @@ void mx_alloc_memory (CONTEXT *ctx)
   
   if (ctx->hdrs)
   {
-    safe_realloc ((void **) &ctx->hdrs, sizeof (HEADER *) * (ctx->hdrmax += 25));
-    safe_realloc ((void **) &ctx->v2r, sizeof (int) * ctx->hdrmax);
+    safe_realloc (&ctx->hdrs, sizeof (HEADER *) * (ctx->hdrmax += 25));
+    safe_realloc (&ctx->v2r, sizeof (int) * ctx->hdrmax);
   }
   else
   {
diff --git a/pager.c b/pager.c
index 731ea10131054c5dab5b8e37303131951e34e7e6..26fcf07e34225f1351b3cdd0afaf23fa6dd475cf 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -758,7 +758,7 @@ resolve_types (char *buf, char *raw, struct line_t *lineInfo, int n, int last,
        if (lineInfo[i].chunks)
        {
          lineInfo[i].chunks = 0;
-         safe_realloc ((void **) &(lineInfo[n].syntax), 
+         safe_realloc (&(lineInfo[n].syntax), 
                        sizeof (struct syntax_t));
        }
        lineInfo[i++].type = MT_COLOR_SIGNATURE;
@@ -833,7 +833,7 @@ resolve_types (char *buf, char *raw, struct line_t *lineInfo, int n, int last,
            if (!found)
            {
              if (++(lineInfo[n].chunks) > 1)
-               safe_realloc ((void **)&(lineInfo[n].syntax), 
+               safe_realloc (&(lineInfo[n].syntax), 
                              (lineInfo[n].chunks) * sizeof (struct syntax_t));
            }
            i = lineInfo[n].chunks - 1;
@@ -1217,7 +1217,7 @@ display_line (FILE *f, long *last_pos, struct line_t **lineInfo, int n,
 
   if (*last == *max)
   {
-    safe_realloc ((void **)lineInfo, sizeof (struct line_t) * (*max += LINES));
+    safe_realloc (lineInfo, sizeof (struct line_t) * (*max += LINES));
     for (ch = *last; ch < *max ; ch++)
     {
       memset (&((*lineInfo)[ch]), 0, sizeof (struct line_t));
@@ -1290,7 +1290,7 @@ display_line (FILE *f, long *last_pos, struct line_t **lineInfo, int n,
     while (regexec (SearchRE, (char *) fmt + offset, 1, pmatch, (offset ? REG_NOTBOL : 0)) == 0)
     {
       if (++((*lineInfo)[n].search_cnt) > 1)
-       safe_realloc ((void **) &((*lineInfo)[n].search),
+       safe_realloc (&((*lineInfo)[n].search),
                      ((*lineInfo)[n].search_cnt) * sizeof (struct syntax_t));
       else
        (*lineInfo)[n].search = safe_malloc (sizeof (struct syntax_t));
@@ -1789,7 +1789,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra)
          lineInfo[i].search_cnt = -1;
          lineInfo[i].quote = NULL;
 
-         safe_realloc ((void **)&(lineInfo[i].syntax),
+         safe_realloc (&(lineInfo[i].syntax),
                        sizeof (struct syntax_t));
          if (SearchCompiled && lineInfo[i].search)
              FREE (&(lineInfo[i].search));
@@ -2290,7 +2290,7 @@ CHECK_IMAP_ACL(IMAP_ACL_DELETE);
            lineInfo[i].search_cnt = -1;
            lineInfo[i].quote = NULL;
 
-           safe_realloc ((void **)&(lineInfo[i].syntax), sizeof (struct syntax_t));
+           safe_realloc (&(lineInfo[i].syntax), sizeof (struct syntax_t));
            if (SearchCompiled && lineInfo[i].search)
                FREE (&(lineInfo[i].search));
          }
diff --git a/parse.c b/parse.c
index 78e4dd73258f260e78410b14b896d76e37c3a223..5317edbb5934cc7d27a3466895723ddb7e8b0aa1 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -77,7 +77,7 @@ static char *read_rfc822_line (FILE *f, char *line, size_t *linelen)
     {
       /* grow the buffer */
       *linelen += STRING;
-      safe_realloc ((void **) &line, *linelen);
+      safe_realloc (&line, *linelen);
       buf = line + offset;
     }
   }
diff --git a/pgp.c b/pgp.c
index 98f7e009e47c4e467f23a4d2c8c55bd5bd241c6e..9fcdd3d3ff7f72443a6c1b22c57d6df4056b39c2 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -1106,7 +1106,7 @@ char *pgp_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
     
   bypass_selection:
     keylist_size += mutt_strlen (keyID) + 4;
-    safe_realloc ((void **)&keylist, keylist_size);
+    safe_realloc (&keylist, keylist_size);
     sprintf (keylist + keylist_used, "%s0x%s", keylist_used ? " " : "",        /* __SPRINTF_CHECKED__ */
             keyID);
     keylist_used = mutt_strlen (keylist);
index 800b07e1ea44a59035051eafe5830f923c17691e..bb98403a3939b6bf5b01fe5463780e97fceeae56 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -474,7 +474,7 @@ static pgp_key_t pgp_select_key (pgp_key_t keys,
       if (i == keymax)
       {
        keymax += 5;
-       safe_realloc ((void **) &KeyTable, sizeof (pgp_key_t) * keymax);
+       safe_realloc (&KeyTable, sizeof (pgp_key_t) * keymax);
       }
       
       KeyTable[i++] = a;
index 65b7c9903a21110b2e4cb55f107532037fe87082..171976a83c41cca491fc2815aaeb78a9939aa092 100644 (file)
--- a/pop_lib.c
+++ b/pop_lib.c
@@ -114,7 +114,7 @@ static int fetch_auth (char *line, void *data)
   }
   else
   {
-    safe_realloc ((void **) &pop_data->auth_list,
+    safe_realloc (&pop_data->auth_list,
            strlen (pop_data->auth_list) + strlen (line) + 2);
     strcat (pop_data->auth_list, " "); /* __STRCAT_CHECKED__ */
   }
@@ -410,7 +410,7 @@ int pop_fetch_data (POP_DATA *pop_data, char *query, char *msg,
       lenbuf = 0;
     }
 
-    safe_realloc ((void **) &inbuf, lenbuf + sizeof (buf));
+    safe_realloc (&inbuf, lenbuf + sizeof (buf));
   }
 
   FREE (&inbuf);
diff --git a/query.c b/query.c
index d15a8590c9687947af85932e79aaf8942bdce425..bcd648c48cdef3c6c84d7a6346273af19873cf3a 100644 (file)
--- a/query.c
+++ b/query.c
@@ -383,7 +383,7 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf)
                int clear = 0;
 
                /* append */
-               safe_realloc ((void **)&QueryTable, menu->max * sizeof (ENTRY));
+               safe_realloc (&QueryTable, menu->max * sizeof (ENTRY));
 
                menu->data = QueryTable;
 
index 5850fe64a3a4b993232278509920a25af6a8113d..09abea2d82250e8d55198fe55816951cd2244c06 100644 (file)
@@ -110,7 +110,7 @@ ATTACHPTR **mutt_gen_attach_list (BODY *m,
   {
     if (*idxlen == *idxmax)
     {
-      safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * ((*idxmax) += 5));
+      safe_realloc (&idx, sizeof (ATTACHPTR *) * ((*idxmax) += 5));
       for (i = *idxlen; i < *idxmax; i++)
        idx[i] = NULL;
     }
index e7be2ceed90b55b3f99c7b304e71332487bbad2e..8172f7c217ab45e364aa02553282f8b4b555ef54 100644 (file)
@@ -104,7 +104,7 @@ static void mix_add_entry (REMAILER ***type2_list, REMAILER *entry,
   if (*used == *slots)
   {
     *slots += 5;
-    safe_realloc ((void **) type2_list, sizeof (REMAILER *) * (*slots));
+    safe_realloc (type2_list, sizeof (REMAILER *) * (*slots));
   }
   
   (*type2_list)[(*used)++] = entry;
@@ -232,7 +232,7 @@ static void mix_screen_coordinates (REMAILER **type2_list,
   if (!chain->cl)
     return;
   
-  safe_realloc ((void **) coordsp, sizeof (struct coord) * chain->cl);
+  safe_realloc (coordsp, sizeof (struct coord) * chain->cl);
   
   coords = *coordsp;
   
index eddcacd0c099eed8a4f7e3c95f8d8864a4610861..f0fc57b802e88f7a5d1322880f4a9188f99d487c 100644 (file)
--- a/rfc1524.c
+++ b/rfc1524.c
@@ -292,7 +292,7 @@ static int rfc1524_mailcap_parse (BODY *a,
              && test_command)
          {
            len = mutt_strlen (test_command) + STRING;
-           safe_realloc ((void **) &test_command, len);
+           safe_realloc (&test_command, len);
            rfc1524_expand_command (a, a->filename, type, test_command, len);
            if (mutt_system (test_command))
            {
index 8e2dd4997739aa4515e0355230b6dc57d8497c65..265fd4d9217e5bd73266df76ad64730632830534 100644 (file)
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -76,7 +76,7 @@ static size_t convert_string (ICONV_CONST char *f, size_t flen,
   
   *tlen = ob - buf;
 
-  safe_realloc ((void **) &buf, ob - buf + 1);
+  safe_realloc (&buf, ob - buf + 1);
   *t = buf;
   iconv_close (cd);
 
@@ -511,7 +511,7 @@ static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col,
     if (bufpos + wlen + strlen (LINEBREAK) > buflen)
     {
       buflen = bufpos + wlen + strlen (LINEBREAK);
-      safe_realloc ((void **) &buf, buflen);
+      safe_realloc (&buf, buflen);
     }
     r = encode_block (buf + bufpos, t, n, icode, tocode, encoder);
     assert (r == wlen);
@@ -527,7 +527,7 @@ static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col,
 
   /* Add last encoded word and us-ascii suffix to buffer. */
   buflen = bufpos + wlen + (u + ulen - t1);
-  safe_realloc ((void **) &buf, buflen + 1);
+  safe_realloc (&buf, buflen + 1);
   r = encode_block (buf + bufpos, t, t1 - t, icode, tocode, encoder);
   assert (r == wlen);
   bufpos += wlen;
index a6d264b36a0803d1a4df599a5b17ef7d316f1f35..3f45650831a5ad8b62e8d8267d9078647928e42d 100644 (file)
--- a/rfc2231.c
+++ b/rfc2231.c
@@ -282,7 +282,7 @@ static void rfc2231_join_continuations (PARAMETER **head,
       
       vl = strlen (par->value);
       
-      safe_realloc ((void **) &value, l + vl + 1);
+      safe_realloc (&value, l + vl + 1);
       strcpy (value + l, par->value);  /* __STRCPY_CHECKED__ */
       l += vl;
 
index 69209e281cc2ab9d96ff79aedf724ced00e0ee09..90ca2c1365410cad3ec0e870b3ff4290803c227b 100644 (file)
--- a/sendlib.c
+++ b/sendlib.c
@@ -1555,7 +1555,7 @@ static void write_references (LIST *r, FILE *f)
   for ( ; (TrimRef == 0 || refcnt < TrimRef) && r ; r = r->next)
   {
     if (refcnt == refmax)
-      safe_realloc ((void **) &ref, (refmax += REF_INC) * sizeof (LIST *));
+      safe_realloc (&ref, (refmax += REF_INC) * sizeof (LIST *));
     ref[refcnt++] = r;
   }
 
@@ -1725,8 +1725,7 @@ static void encode_headers (LIST *h)
       continue;
     
     rfc2047_encode_string (&tmp);
-    safe_realloc ((void **) &h->data, 
-                 mutt_strlen (h->data) + 2 + mutt_strlen (tmp) + 1);
+    safe_realloc (&h->data, mutt_strlen (h->data) + 2 + mutt_strlen (tmp) + 1);
 
     sprintf (h->data + i, ": %s", NONULL (tmp));  /* __SPRINTF_CHECKED__ */
     
@@ -1951,7 +1950,7 @@ add_args (char **args, size_t *argslen, size_t *argsmax, ADDRESS *addr)
     if (addr->mailbox && !addr->group)
     {
       if (*argslen == *argsmax)
-       safe_realloc ((void **) &args, (*argsmax += 5) * sizeof (char *));
+       safe_realloc (&args, (*argsmax += 5) * sizeof (char *));
       args[(*argslen)++] = addr->mailbox;
     }
   }
@@ -1962,7 +1961,7 @@ static char **
 add_option (char **args, size_t *argslen, size_t *argsmax, char *s)
 {
   if (*argslen == *argsmax)
-    safe_realloc ((void **) &args, (*argsmax += 5) * sizeof (char *));
+    safe_realloc (&args, (*argsmax += 5) * sizeof (char *));
   args[(*argslen)++] = s;
   return (args);
 }
@@ -1998,7 +1997,7 @@ mutt_invoke_sendmail (ADDRESS *from,      /* the sender */
   while ((ps = strtok (ps, " ")))
   {
     if (argslen == argsmax)
-      safe_realloc ((void **) &args, sizeof (char *) * (argsmax += 5));
+      safe_realloc (&args, sizeof (char *) * (argsmax += 5));
 
     if (i)
       args[argslen++] = ps;
@@ -2040,7 +2039,7 @@ mutt_invoke_sendmail (ADDRESS *from,      /* the sender */
   args = add_args (args, &argslen, &argsmax, bcc);
 
   if (argslen == argsmax)
-    safe_realloc ((void **) &args, sizeof (char *) * (++argsmax));
+    safe_realloc (&args, sizeof (char *) * (++argsmax));
   
   args[argslen++] = NULL;
 
@@ -2083,7 +2082,7 @@ mutt_invoke_sendmail (ADDRESS *from,      /* the sender */
 char *mutt_append_string (char *a, const char *b)
 {
   size_t la = mutt_strlen (a);
-  safe_realloc ((void **) &a, la + mutt_strlen (b) + 1);
+  safe_realloc (&a, la + mutt_strlen (b) + 1);
   strcpy (a + la, b);  /* __STRCPY_CHECKED__ */
   return (a);
 }
@@ -2120,7 +2119,7 @@ char *mutt_quote_string (const char *s)
     if (INVALID_CHAR (*s))
     {
       size_t o = pr - r;
-      safe_realloc ((void **) &r, ++rlen);
+      safe_realloc (&r, ++rlen);
       pr = r + o;
       *pr++ = '\\';
     }
diff --git a/smime.c b/smime.c
index 51237edf2c3883f4b586ae69812a17f051b23471..a2da21f2bf2b6c2603a65999a938ca45740e3e35 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -792,7 +792,7 @@ char *smime_findKeys (ADDRESS *to, ADDRESS *cc, ADDRESS *bcc)
     }
     
     keylist_size += mutt_strlen (keyID) + 1;
-    safe_realloc ((void **)&keylist, keylist_size);
+    safe_realloc (&keylist, keylist_size);
     sprintf (keylist + keylist_used, "%s", keyID);     /* __SPRINTF_CHECKED__ */
     keylist_used = mutt_strlen (keylist);
 
index 1f0ad33e366d52e17d41757475bef16887f5bae5..b26a7878a0e79f7af4ee2d96e9d0a8209ec0bbce 100644 (file)
--- a/thread.c
+++ b/thread.c
@@ -630,8 +630,7 @@ THREAD *mutt_sort_subthreads (THREAD *thread, int init)
        for (i = 0; thread; i++, thread = thread->prev)
        {
          if (i >= array_size)
-           safe_realloc ((void **) &array,
-                         (array_size *= 2) * sizeof (THREAD *));
+           safe_realloc (&array, (array_size *= 2) * sizeof (THREAD *));
 
          array[i] = thread;
        }