]> git.marmaro.de Git - mmh/blobdiff - uip/flist.c
* h/utils.h, sbr/utils.c, uip/flist.c, uip/folder.c: Move duplicate
[mmh] / uip / flist.c
index 1e850cbc65e88d35e8aed95e9a5527c047e32914..36be1ed29b673b1be43907fb3dc05a703e175b06 100644 (file)
@@ -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++] =
@@ -605,29 +603,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)));
     }
 }