X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;ds=sidebyside;f=uip%2Fflist.c;h=36be1ed29b673b1be43907fb3dc05a703e175b06;hb=d2da15ecabb03fb2de72863abdf5f21e52fdf329;hp=1e850cbc65e88d35e8aed95e9a5527c047e32914;hpb=81a21a9a97d8633f6d6231e31fdb6e328d0d3ff2;p=mmh diff --git a/uip/flist.c b/uip/flist.c index 1e850cb..36be1ed 100644 --- a/uip/flist.c +++ b/uip/flist.c @@ -114,7 +114,6 @@ int AddFolder(char *, int); void BuildFolderList(char *, int); void BuildFolderListRecurse(char *, struct stat *, int); void PrintFolders(void); -static int num_digits (int); void AllocFolders(struct Folder **, int *, int); int AssignPriority(char *); static void do_readonly_folders(void); @@ -228,9 +227,8 @@ main(int argc, char **argv) */ if (numfolders >= maxfolders) { maxfolders += MAXFOLDERS; - if (!(foldersToDo = (char **) realloc (foldersToDo, - (size_t) (maxfolders * sizeof(*foldersToDo))))) - adios (NULL, "unable to reallocate folder name storage"); + foldersToDo = (char **) mh_xrealloc (foldersToDo, + (size_t) (maxfolders * sizeof(*foldersToDo))); } if (*cp == '+' || *cp == '@') { foldersToDo[numfolders++] = @@ -606,29 +604,6 @@ PrintFolders(void) } /* - * Calculate the number of digits in a nonnegative integer - */ -static int -num_digits (int n) -{ - int ndigits = 0; - - /* Sanity check */ - if (n < 0) - adios (NULL, "oops, num_digits called with negative value"); - - if (n == 0) - return 1; - - while (n) { - n /= 10; - ndigits++; - } - - return ndigits; -} - -/* * Put them in priority order. */ @@ -655,7 +630,7 @@ AllocFolders(struct Folder **f, int *nfa, int n) *f = (struct Folder *) mh_xmalloc (*nfa * (sizeof(struct Folder))); } else { *nfa *= 2; - *f = (struct Folder *) realloc (*f, *nfa * (sizeof(struct Folder))); + *f = (struct Folder *) mh_xrealloc (*f, *nfa * (sizeof(struct Folder))); } }