From: Martin Quinson Date: Wed, 24 Feb 2016 07:13:02 +0000 (+0100) Subject: kill several unused functions in xbt X-Git-Tag: v3_13~712 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/84a3dfad9368c3d7901eaa0a58ffb95ccccb8bc5 kill several unused functions in xbt --- diff --git a/include/xbt/str.h b/include/xbt/str.h index b90f86bf1e..8ba1010a0e 100644 --- a/include/xbt/str.h +++ b/include/xbt/str.h @@ -50,13 +50,10 @@ XBT_PUBLIC(void) xbt_str_subst(char *str, char from, char to, int amount); XBT_PUBLIC(char *) xbt_str_varsubst(const char *str, xbt_dict_t patterns); /* */ -XBT_PUBLIC(void) xbt_str_strip_spaces(char *); XBT_PUBLIC(char *) xbt_str_diff(const char *a, const char *b); XBT_PUBLIC(char *) xbt_str_from_file(FILE * file); -XBT_PUBLIC(int) xbt_str_start_with(const char* str, const char* start); - XBT_PUBLIC(long int) xbt_str_parse_int(const char* str, const char* error_msg); XBT_PUBLIC(double) xbt_str_parse_double(const char* str, const char* error_msg); diff --git a/include/xbt/virtu.h b/include/xbt/virtu.h index 3b0a63e086..2f140feef0 100644 --- a/include/xbt/virtu.h +++ b/include/xbt/virtu.h @@ -25,13 +25,5 @@ XBT_PUBLIC_DATA(char*) xbt_binary_name; /** Contains all the parameters we got from the command line (including argv[0]) */ XBT_PUBLIC_DATA(xbt_dynar_t) xbt_cmdline; -/** - * - * Time management functions, returns the system time or sleeps a process. - */ -XBT_PUBLIC(double) xbt_time(void); -XBT_PUBLIC(void) xbt_sleep(double sec); - - SG_END_DECL() #endif /* __XBT_VIRTU_H__ */ diff --git a/src/xbt/xbt_sha.c b/src/xbt/xbt_sha.c index baa24c3256..aa3dd12b64 100644 --- a/src/xbt/xbt_sha.c +++ b/src/xbt/xbt_sha.c @@ -32,11 +32,8 @@ static void sha_calculate(xbt_sha_t sha); /** @brief constructor */ xbt_sha_t xbt_sha_new(void) { - xbt_sha_t sha; - - sha = xbt_new(s_xbt_sha_t, 1); + xbt_sha_t sha = xbt_new(s_xbt_sha_t, 1); xbt_sha_reset(sha); - return sha; } diff --git a/src/xbt/xbt_str.c b/src/xbt/xbt_str.c index cee4235042..fb1a0af27c 100644 --- a/src/xbt/xbt_str.c +++ b/src/xbt/xbt_str.c @@ -124,50 +124,6 @@ void xbt_str_trim(char *s, const char *char_list) xbt_str_ltrim(s, char_list); } -/** @brief Replace double whitespaces (but no other characters) from the string. - * - * The function modifies the string so that each time that several spaces appear, - * they are replaced by a single space. It will only do so for spaces (ASCII 32, 0x20). - * - * @param s The string to strip. Modified in place. - * - */ -void xbt_str_strip_spaces(char *s) -{ - char *p = s; - int e = 0; - - if (!s) - return; - - while (1) { - if (!*p) - goto end; - - if (*p != ' ') - break; - - p++; - } - - e = 1; - - do { - if (e) - *s++ = *p; - - if (!*++p) - goto end; - - if (e ^ (*p != ' ')) - if ((e = !e)) - *s++ = ' '; - } while (1); - -end: - *s = '\0'; -} - /** @brief Substitutes a char for another in a string * * @param str the string to modify @@ -852,28 +808,6 @@ char *xbt_str_from_file(FILE * file) return res; } -/* @brief Retrun 1 if string 'str' starts with string 'start' - * - * \param str a string - * \param start the string to search in str - * - * \return 1 if 'str' starts with 'start' - */ -int xbt_str_start_with(const char* str, const char* start) -{ - unsigned int i; - size_t l_str = strlen(str); - size_t l_start = strlen(start); - - if(l_start > l_str) return 0; - - for(i = 0; i< l_start; i++){ - if(str[i] != start[i]) return 0; - } - - return 1; -} - /** @brief Parse an integer out of a string, or raise an error * * The #str is passed as argument to your #error_msg, as follows: diff --git a/src/xbt/xbt_virtu.c b/src/xbt/xbt_virtu.c index a046cfa9a3..2d44621341 100644 --- a/src/xbt/xbt_virtu.c +++ b/src/xbt/xbt_virtu.c @@ -18,23 +18,6 @@ static int xbt_fake_pid(void) int_f_void_t xbt_getpid = xbt_fake_pid; -/* - * Time elapsed since the beginning of the simulation. - */ -double xbt_time() -{ - /* FIXME: check if we should use the request mechanism or not */ - return SIMIX_get_clock(); -} - -/* - * Freeze the process for the specified amount of time - */ -void xbt_sleep(double sec) -{ - simcall_process_sleep(sec); -} - const char *xbt_procname(void) { return SIMIX_process_self_get_name();