for (i = 0; mp->msgattrs[i]; i++)
free(mp->msgattrs[i]);
- free(mp->msgstats); /* free message status area */
+ free(mp->msgstats); /* free message status area */
free(mp); /* free main folder structure */
}
/* for testing, allocate minimal necessary space */
/* mp->hghoff = max(mp->hghmsg, 1); */
- /*
- ** Allocate space for status of each message.
- */
+ /* Allocate space for status of each message. */
+
mp->msgstats = mh_xmalloc(MSGSTATSIZE(mp, mp->lowoff, mp->hghoff));
/*
** Clear all the flag bits for all the message
** status entries we just allocated.
+ ** TODO: use memset() ?
*/
for (msgnum = mp->lowoff; msgnum <= mp->hghoff; msgnum++)
clear_msg_flags(mp, msgnum);
/* then copy messages status array with shift */
if (mp->nummsg > 0) {
- for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++)
+ for (msgnum=mp->lowmsg; msgnum<=mp->hghmsg; msgnum++) {
tmpstats[msgnum - lo] = mp->msgstats[msgnum - mp->lowoff];
+ }
}
free(mp->msgstats);
mp->msgstats = tmpstats;
void *memory;
/* Some non-POSIX realloc()s don't cope with realloc(NULL,sz) */
- if (!ptr)
+ if (!ptr) {
return mh_xmalloc(size);
+ }
if (size == 0)
- adios(NULL, "Tried to realloc 0bytes");
+ adios(NULL, "Tried to realloc 0 bytes");
memory = realloc(ptr, size);
if (!memory)
case FLD:
case FLDEOF:
case FLDPLUS:
- if (bp != NULL)
- free(bp), bp = NULL;
+ if (bp != NULL) {
+ free(bp);
+ bp = NULL;
+ }
bp = getcpy(buf);
while (state == FLDPLUS) {
state = m_getfld(state, name, buf,