X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fflist.c;h=63fcb0f50aff921d5aafbb27ec56d6cd9cc4bc72;hp=68acabb11f3ca5d7f2eae0cc05cfe67062f68c1c;hb=e917512db8efcbf3b5b5baeb64b6d345fd3686db;hpb=5ba9c2f13fedf1d8d6ed907ef1f505616290efaa diff --git a/uip/flist.c b/uip/flist.c index 68acabb..63fcb0f 100644 --- a/uip/flist.c +++ b/uip/flist.c @@ -143,8 +143,7 @@ main(int argc, char **argv) /* allocate the initial space to record the folder names */ numfolders = 0; maxfolders = MAXFOLDERS; - foldersToDo = (char **) mh_xmalloc((size_t) - (maxfolders * sizeof(*foldersToDo))); + foldersToDo = mh_xcalloc(maxfolders, sizeof(*foldersToDo)); /* no sequences yet */ numsequences = 0; @@ -221,10 +220,10 @@ main(int argc, char **argv) */ if (numfolders >= maxfolders) { maxfolders += MAXFOLDERS; - foldersToDo = (char **) mh_xrealloc(foldersToDo, (size_t) (maxfolders * sizeof(*foldersToDo))); + foldersToDo = mh_xrealloc(foldersToDo, maxfolders * sizeof(*foldersToDo)); } if (*cp == '+' || *cp == '@') { - foldersToDo[numfolders++] = getcpy(expandfol(cp)); + foldersToDo[numfolders++] = mh_xstrdup(expandfol(cp)); } else foldersToDo[numfolders++] = cp; } @@ -251,7 +250,7 @@ main(int argc, char **argv) } else { cp = seq_unseen; /* use default */ } - dp = getcpy(cp); + dp = mh_xstrdup(cp); ap = brkstring(dp, " ", "\n"); for (; ap && *ap; ap++) { if (numsequences >= NUMATTRS) { @@ -295,7 +294,7 @@ GetFolderOrder(void) AllocFolders(&orders, &nOrdersAlloced, nOrders + 1); o = &orders[nOrders++]; o->priority = priority++; - o->name = (char *) mh_xmalloc(p - s + 1); + o->name = mh_xcalloc(p - s + 1, sizeof(char)); strncpy(o->name, s, p - s); o->name[p - s] = 0; } else @@ -465,7 +464,7 @@ AddFolder(char *name, int force) /* Oops, error occurred. Record it and continue. */ AllocFolders(&folders, &nFoldersAlloced, nFolders + 1); f = &folders[nFolders++]; - f->name = getcpy(name); + f->name = mh_xstrdup(name); f->error = 1; f->priority = AssignPriority(f->name); return 0; @@ -502,7 +501,7 @@ AddFolder(char *name, int force) /* save general folder information */ AllocFolders(&folders, &nFoldersAlloced, nFolders + 1); f = &folders[nFolders++]; - f->name = getcpy(name); + f->name = mh_xstrdup(name); f->nMsgs = mp->nummsg; f->error = 0; f->priority = AssignPriority(f->name); @@ -624,12 +623,10 @@ AllocFolders(struct Folder **f, int *nfa, int n) return; if (*f == NULL) { *nfa = 10; - *f = (struct Folder *) mh_xmalloc( - *nfa * (sizeof(struct Folder))); + *f = mh_xcalloc(*nfa, sizeof(struct Folder)); } else { *nfa *= 2; - *f = (struct Folder *) mh_xrealloc( - *f, *nfa * (sizeof(struct Folder))); + *f = mh_xrealloc(*f, *nfa * sizeof(struct Folder)); } }