1 /* m_remsg.c - realloc a msgs structure */
3 static char ident[] = "@(#)$Id: m_remsg.c,v 1.8 1992/12/15 00:20:22 jromine Exp $";
10 struct msgs *m_remsg (mp, lo, hi)
11 register struct msgs *mp;
21 if (lo == 0 && (lo = mp -> lowmsg) == 0)
23 if (hi < mp -> hghmsg)
24 hi = mp -> hghmsg + (MAXFOLDER - mp -> nummsg);
25 if (hi <= mp -> hghmsg)
26 hi = mp -> hghmsg + MAXFOLDER;
27 if (lo == mp -> lowmsg && hi == mp -> hghmsg)
31 mp = (struct msgs *) realloc ((char *) mp, MHSIZE (mp, lo, hi));
33 adios (NULLCP, "unable to re-allocate folder storage");
35 if ((sp = (int *) calloc ((unsigned) 1, MHSIZEX (mp, lo, hi))) == NULL)
36 adios (NULLCP, "unable to re-allocate messages storage");
40 adios (NULLCP, "m_remsg() botch -- you lose big[1]");
41 for (msgnum = mp -> lowmsg; msgnum <= mp -> hghmsg; msgnum++)
42 pp[msgnum] = mp -> msgstats[msgnum];
43 free ((char *) mp -> msgbase);
49 mp -> msgstats = (mp -> msgbase = mp -> msgstats) - mp -> lowoff;
50 if (mp -> msgstats < (int *)0)
51 adios (NULLCP, "m_remsg() botch -- you lose big[2]");
53 for (msgnum = mp -> lowmsg - 1; msgnum >= lo; msgnum--)
54 mp -> msgstats[msgnum] = 0;
55 for (msgnum = mp -> hghmsg + 1; msgnum <= hi; msgnum++)
56 mp -> msgstats[msgnum] = 0;