projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Call context_read() before getting filter in repl
[mmh]
/
uip
/
sortm.c
diff --git
a/uip/sortm.c
b/uip/sortm.c
index
0d02af9
..
5d15ed6
100644
(file)
--- a/
uip/sortm.c
+++ b/
uip/sortm.c
@@
-197,7
+197,7
@@
main(int argc, char **argv)
/*
** sort a list of pointers to our "messages to be sorted".
*/
/*
** sort a list of pointers to our "messages to be sorted".
*/
- dlist = (struct smsg **) mh_xmalloc((nmsgs+1) * sizeof(*dlist));
+ dlist = (struct smsg **) mh_xcalloc((size_t) (nmsgs+1), sizeof(*dlist));
for (i = 0; i < nmsgs; i++)
dlist[i] = &smsgs[i];
dlist[nmsgs] = 0;
for (i = 0; i < nmsgs; i++)
dlist[i] = &smsgs[i];
dlist[nmsgs] = 0;
@@
-235,7
+235,7
@@
main(int argc, char **argv)
** the collection of messages with the same subj
** given a message number.
*/
** the collection of messages with the same subj
** given a message number.
*/
- il = (struct smsg ***) calloc(mp->hghsel+1, sizeof(*il));
+ il = (struct smsg ***) mh_xcalloc(mp->hghsel+1, sizeof(*il));
if (! il)
adios(EX_OSERR, NULL, "couldn't allocate msg list");
for (i = 0; i < nmsgs; i++)
if (! il)
adios(EX_OSERR, NULL, "couldn't allocate msg list");
for (i = 0; i < nmsgs; i++)
@@
-295,10
+295,8
@@
read_hdrs(struct msgs *mp, char *datesw)
twscopy(&tb, dlocaltimenow());
twscopy(&tb, dlocaltimenow());
- smsgs = (struct smsg *) calloc((size_t) (mp->hghsel - mp->lowsel + 2),
+ smsgs = (struct smsg *) mh_xcalloc((size_t) (mp->hghsel - mp->lowsel + 2),
sizeof(*smsgs));
sizeof(*smsgs));
- if (smsgs == NULL)
- adios(EX_OSERR, NULL, "unable to allocate sort storage");
s = smsgs;
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
s = smsgs;
for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
@@
-336,7
+334,6
@@
get_fields(char *datesw, int msg, struct smsg *smsg)
for (compnum = 1, state = FLD;;) {
switch (state = m_getfld(state, nam, buf, sizeof(buf), in)) {
case FLD:
for (compnum = 1, state = FLD;;) {
switch (state = m_getfld(state, nam, buf, sizeof(buf), in)) {
case FLD:
- case FLDEOF:
case FLDPLUS:
compnum++;
if (!mh_strcasecmp(nam, datesw)) {
case FLDPLUS:
compnum++;
if (!mh_strcasecmp(nam, datesw)) {
@@
-366,7
+363,6
@@
get_fields(char *datesw, int msg, struct smsg *smsg)
continue;
case BODY:
continue;
case BODY:
- case BODYEOF:
case FILEEOF:
break;
case FILEEOF:
break;