X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fms_setting.c;h=c3444c9aa78b203714d1473560b79a3d59247f0d;hb=cc47230b8dfe0bcd31d4f45ca84d2dd35ae360f0;hp=eb5e40557ba512149a334d65ad9ea368a6668ed3;hpb=4408f5168a2640feb59f16987833b36f206176cb;p=m6w6%2Flibmemcached diff --git a/clients/ms_setting.c b/clients/ms_setting.c index eb5e4055..c3444c9a 100644 --- a/clients/ms_setting.c +++ b/clients/ms_setting.c @@ -19,7 +19,6 @@ #include #include #include -#include #include @@ -54,7 +53,7 @@ ms_setting_st ms_setting; /* store the settings specified by user */ /* read setting from configuration file */ static void ms_get_serverlist(char *str); -static int ms_get_cpu_count(void); +static uint32_t ms_get_cpu_count(void); ms_conf_type_t ms_get_conf_type(char *line); static int ms_is_line_data(char *line); static int ms_read_is_data(char *line, ssize_t nread); @@ -196,9 +195,9 @@ static void ms_get_serverlist(char *str) /** * used to get the CPU count of the current system * - * @return return the cpu count if get, else return 1 + * @return return the cpu count if get, else return EXIT_FAILURE */ -static int ms_get_cpu_count() +static uint32_t ms_get_cpu_count() { #ifdef HAVE__SC_NPROCESSORS_ONLN return sysconf(_SC_NPROCESSORS_CONF); @@ -224,7 +223,7 @@ static int ms_get_cpu_count() #endif /* the system with one cpu at least */ - return 1; + return EXIT_FAILURE; } /* ms_get_cpu_count */ @@ -263,7 +262,7 @@ ms_conf_type_t ms_get_conf_type(char *line) * * @param line, string of one line * - * @return if success, return 1, else return 0 + * @return if success, return EXIT_FAILURE, else return EXIT_SUCCESS */ static int ms_is_line_data(char *line) { @@ -276,9 +275,9 @@ static int ms_is_line_data(char *line) begin_ptr++; } if ((begin_ptr[0] == '\0') || (begin_ptr[0] == '#')) - return 0; + return EXIT_SUCCESS; - return 1; + return EXIT_FAILURE; } /* ms_is_line_data */ @@ -288,14 +287,14 @@ static int ms_is_line_data(char *line) * @param line, string of one line * @param nread, length of the line * - * @return if it's EOF or not line data, return 0, else return 1 + * @return if it's EOF or not line data, return EXIT_SUCCESS, else return EXIT_FAILURE */ static int ms_read_is_data(char *line, ssize_t nread) { if ((nread == EOF) || ! ms_is_line_data(line)) - return 0; + return EXIT_SUCCESS; - return 1; + return EXIT_FAILURE; } /* ms_read_is_data */ @@ -576,7 +575,7 @@ static void ms_calc_avg_size() * @param distr, pointer of distribution structure array * @param length, length of the array * - * @return always return 0 + * @return always return EXIT_SUCCESS */ static int ms_shuffle_distr(ms_distr_t *distr, int length) { @@ -615,7 +614,7 @@ static int ms_shuffle_distr(ms_distr_t *distr, int length) } /* switch */ } - return 0; + return EXIT_SUCCESS; } /* ms_shuffle_distr */