From: Josh Bressers Date: Tue, 21 Feb 2006 01:11:51 +0000 (+0000) Subject: * h/utils.h, sbr/utils.c, uip/flist.c, uip/folder.c: Move duplicate X-Git-Tag: nmh-1_3_RC1~56 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=0cebd8284370988c8b1807ef2544bd80804d074e * h/utils.h, sbr/utils.c, uip/flist.c, uip/folder.c: Move duplicate function num_digits into utils.c --- diff --git a/ChangeLog b/ChangeLog index d4efdf4..0708ca2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-02-20 Josh Bressers + + * h/utils.h, sbr/utils.c, uip/flist.c, uip/folder.c: Move duplicate + function num_digits into utils.c + 2006-02-19 Josh Bressers * sbr/m_draft.c, sbr/utils.c, uip/folder.c, uip/inc.c, diff --git a/h/utils.h b/h/utils.h index 950e8a9..8246a5d 100644 --- a/h/utils.h +++ b/h/utils.h @@ -10,3 +10,4 @@ void *mh_xrealloc(void *, size_t); char *pwd(void); char *add(char *, char *); void create_folder(char *, int, void (*)()); +int num_digits(int); diff --git a/sbr/utils.c b/sbr/utils.c index 2a7a1cc..c433e8f 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -141,3 +141,27 @@ void create_folder(char *folder, int autocreate, void (*done_callback)()) adios (NULL, "unable to create folder %s", folder); } } + +/* + * num_digits + * Return the number of digits in a nonnegative integer. + */ +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; +} diff --git a/uip/flist.c b/uip/flist.c index 758d308..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); @@ -605,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. */ diff --git a/uip/folder.c b/uip/folder.c index 9d85e89..b332af0 100644 --- a/uip/folder.c +++ b/uip/folder.c @@ -121,7 +121,6 @@ static int maxFolderInfo; static void dodir (char *); static int get_folder_info (char *, char *); static void print_folders (void); -static int num_digits (int); static int sfold (struct msgs *, char *); static void addir (char *); static void addfold (char *); @@ -641,29 +640,6 @@ print_folders (void) } /* - * Calculate the number of digits in a nonnegative integer - */ -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; -} - -/* * Set the current message and sychronize sequences */