X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fflist.c;h=b5226ceaa8f97d8d0aa0d8b463de894578651a26;hp=1e850cbc65e88d35e8aed95e9a5527c047e32914;hb=d8916ff5d389de5ab225cd6f40aeda1b285d0f28;hpb=81a21a9a97d8633f6d6231e31fdb6e328d0d3ff2 diff --git a/uip/flist.c b/uip/flist.c index 1e850cb..b5226ce 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,13 +227,12 @@ 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++] = - path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF); + pluspath (cp); } else foldersToDo[numfolders++] = cp; } @@ -278,7 +276,8 @@ main(int argc, char **argv) ScanFolders(); qsort(folders, nFolders, sizeof(struct Folder), (qsort_comp) CompareFolders); PrintFolders(); - return done (0); + done (0); + return 1; } /* @@ -289,7 +288,7 @@ main(int argc, char **argv) void GetFolderOrder(void) { - char *p, *s; + unsigned char *p, *s; int priority = 1; struct Folder *o; @@ -401,7 +400,8 @@ BuildFolderList(char *dirName, int searchdepth) void BuildFolderListRecurse(char *dirName, struct stat *s, int searchdepth) { - char *base, *n, name[PATH_MAX]; + char *base, name[PATH_MAX]; + unsigned char *n; int nlinks; DIR *dir; struct dirent *dp; @@ -606,29 +606,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 +632,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))); } }