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++)
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);
{
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];
}
break;
if (idxlen == idxmax)
{
- safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5));
+ safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5));
menu->data = idx;
}
if (idxlen + numfiles >= idxmax)
{
- safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5 + numfiles));
+ safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5 + numfiles));
menu->data = idx;
}
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;
}
}
if (idxlen == idxmax)
{
- safe_realloc ((void **) &idx, sizeof (ATTACHPTR *) * (idxmax += 5));
+ safe_realloc (&idx, sizeof (ATTACHPTR *) * (idxmax += 5));
menu->data = idx;
}
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);
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__ */
}
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);
buflen = linelen + 3;
- safe_realloc ((void **) h, buflen);
+ safe_realloc (h, buflen);
for (count = 0; a; a = a->next, count++)
{
ADDRESS *tmp = a->next;
}
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__ */
else
{
if((*n % 5) == 0)
- safe_realloc ((void **) signatures, (*n + 6) * sizeof (BODY **));
+ safe_realloc (signatures, (*n + 6) * sizeof (BODY **));
(*signatures)[(*n)++] = a;
}
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;
}
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);
}
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;
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
{
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);
}
if (i >= wbuflen)
{
wbuflen = i + 20;
- safe_realloc ((void **) &wbuf, wbuflen * sizeof (*wbuf));
+ safe_realloc (&wbuf, wbuflen * sizeof (*wbuf));
}
wbuf[i++] = wc;
}
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 */
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 ();
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
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;
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;
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;
}
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' )
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)
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)));
{
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));
/* 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));
}
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)
{
*p = r;
}
-void safe_free (void **p)
+void safe_free (void *ptr)
{
+ void **p = (void **)ptr;
if (*p)
{
free (*p); /* __MEM_CHECKED__ */
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 */
/* 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);
}
}
}
# 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
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
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;
}
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__ */
}
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__ */
}
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);
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
{
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;
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;
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));
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));
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));
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));
}
{
/* grow the buffer */
*linelen += STRING;
- safe_realloc ((void **) &line, *linelen);
+ safe_realloc (&line, *linelen);
buf = line + offset;
}
}
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);
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;
}
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__ */
}
lenbuf = 0;
}
- safe_realloc ((void **) &inbuf, lenbuf + sizeof (buf));
+ safe_realloc (&inbuf, lenbuf + sizeof (buf));
}
FREE (&inbuf);
int clear = 0;
/* append */
- safe_realloc ((void **)&QueryTable, menu->max * sizeof (ENTRY));
+ safe_realloc (&QueryTable, menu->max * sizeof (ENTRY));
menu->data = QueryTable;
{
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;
}
if (*used == *slots)
{
*slots += 5;
- safe_realloc ((void **) type2_list, sizeof (REMAILER *) * (*slots));
+ safe_realloc (type2_list, sizeof (REMAILER *) * (*slots));
}
(*type2_list)[(*used)++] = entry;
if (!chain->cl)
return;
- safe_realloc ((void **) coordsp, sizeof (struct coord) * chain->cl);
+ safe_realloc (coordsp, sizeof (struct coord) * chain->cl);
coords = *coordsp;
&& 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))
{
*tlen = ob - buf;
- safe_realloc ((void **) &buf, ob - buf + 1);
+ safe_realloc (&buf, ob - buf + 1);
*t = buf;
iconv_close (cd);
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);
/* 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;
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;
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;
}
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__ */
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;
}
}
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);
}
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;
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;
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);
}
if (INVALID_CHAR (*s))
{
size_t o = pr - r;
- safe_realloc ((void **) &r, ++rlen);
+ safe_realloc (&r, ++rlen);
pr = r + o;
*pr++ = '\\';
}
}
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);
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;
}