X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Ffolder_read.c;h=292044841ba529fca0bee02349f67f3fa7f529f9;hb=0d33f1e27c4edb7290ef51cd03d50c0dbc9059ef;hp=6cd0d109305dc180398c4fdf392b722950fa0bb7;hpb=c066fcb6cd31e473e0880849a92da361b9e88d98;p=mmh diff --git a/sbr/folder_read.c b/sbr/folder_read.c index 6cd0d10..2920448 100644 --- a/sbr/folder_read.c +++ b/sbr/folder_read.c @@ -2,14 +2,13 @@ /* * folder_read.c -- initialize folder structure and read folder * - * $Id$ - * * This code is Copyright (c) 2002, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. */ #include +#include /* We allocate the `mi' array 1024 elements at a time */ #define NUMMSGS 1024 @@ -44,8 +43,7 @@ folder_read (char *name) } /* Allocate the main structure for folder information */ - if (!(mp = (struct msgs *) malloc ((size_t) sizeof(*mp)))) - adios (NULL, "unable to allocate folder storage"); + mp = (struct msgs *) mh_xmalloc ((size_t) sizeof(*mp)); clear_folder_flags (mp); mp->foldpath = name; @@ -66,8 +64,7 @@ folder_read (char *name) * name of the messages in this folder. */ len = NUMMSGS; - if (!(mi = (int *) malloc ((size_t) (len * sizeof(*mi))))) - adios (NULL, "unable to allocate storage"); + mi = (int *) mh_xmalloc ((size_t) (len * sizeof(*mi))); while ((dp = readdir (dd))) { if ((msgnum = m_atoi (dp->d_name)) && msgnum > 0) { @@ -77,10 +74,7 @@ folder_read (char *name) */ if (mp->nummsg >= len) { len += NUMMSGS; - if (!(mi = (int *) realloc (mi, - (size_t) (len * sizeof(*mi))))) { - adios (NULL, "unable to allocate storage"); - } + mi = (int *) mh_xrealloc (mi, (size_t) (len * sizeof(*mi))); } /* Check if this is the first message we've seen */ @@ -105,9 +99,6 @@ folder_read (char *name) switch (dp->d_name[0]) { case '.': case ',': -#ifdef MHE - case '+': -#endif /* MHE */ continue; default: @@ -138,8 +129,7 @@ folder_read (char *name) /* * Allocate space for status of each message. */ - if (!(mp->msgstats = malloc (MSGSTATSIZE(mp, mp->lowoff, mp->hghoff)))) - adios (NULL, "unable to allocate storage for msgstats"); + mp->msgstats = mh_xmalloc (MSGSTATSIZE(mp, mp->lowoff, mp->hghoff)); /* * Clear all the flag bits for all the message