diff options
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r-- | libglusterfs/src/common-utils.c | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 08efb5c9f03..7862f6aa01b 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -2994,76 +2994,6 @@ backtrace_symbols(void *const *trace, size_t len) #undef BELOW #endif /* __NetBSD__ */ -/* TODO: extract common code from gf_get_soft_limit and gf_get_hard_limit into a - * function - */ -int -gf_get_soft_limit (char *limit, char **soft_limit) -{ - int colon_count = 0; - int i = 0; - int len = 0; - char *sl = NULL; - - len = strlen (limit); - for (i = 0; i < len; i++) { - if (limit[i] == ':') - colon_count++; - if (colon_count == 2) - break; - } - - if (colon_count != 2) { - gf_log ("common-utils", GF_LOG_DEBUG, "Soft-limit absent"); - return 0; - } - - sl = GF_CALLOC (len - i, sizeof (char), gf_common_mt_char); - if (!sl) - return -1; - strncpy (sl, &limit[i+1], len - i - 1); - *soft_limit = sl; - - return 1; -} - -int -gf_get_hard_limit (char *limit, char **hard_limit) -{ - int i = 0; - int hlbegin = 0; - int len = 0; - char *hl = NULL; - - len = strlen (limit); - - for (i = 0; i < len; i++) { - if (limit[i] == ':') - break; - } - - if (i == len) { - gf_log ("common-utils", GF_LOG_ERROR, "Hard limit not found"); - return -1; - } - - hlbegin = i + 1; - i++; - - while ((limit[i] != '\0') && (limit[i] != ':')) { - i++; - } - - hl = GF_CALLOC (i - hlbegin + 1, sizeof (char), gf_common_mt_char); - if (!hl) - return -1; - - strncpy (hl, &limit[hlbegin], i - hlbegin); - *hard_limit = hl; - - return 0; -} - int gf_skip_header_section (int fd, int header_len) { |