diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-04-08 12:02:40 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-04-13 14:47:07 +1000 |
commit | 2eea91957c90d6a5960b5350d2c4664812260a7b (patch) | |
tree | 792b34f76b72f3b7e0ade24b5f0b03bae30bb4f9 /lib/util/util_str.c | |
parent | 9941dfe9f6532ecbc317685046d74e6f90c41695 (diff) | |
download | samba-2eea91957c90d6a5960b5350d2c4664812260a7b.tar.gz |
lib/util Move simple string routines into common code.
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'lib/util/util_str.c')
-rw-r--r-- | lib/util/util_str.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/lib/util/util_str.c b/lib/util/util_str.c index 41183ff5704..f31a8c55986 100644 --- a/lib/util/util_str.c +++ b/lib/util/util_str.c @@ -148,30 +148,6 @@ _PUBLIC_ const char *str_format_nbt_domain(TALLOC_CTX *mem_ctx, const char *s) } /** - * Add a string to an array of strings. - * - * num should be a pointer to an integer that holds the current - * number of elements in strings. It will be updated by this function. - */ -_PUBLIC_ bool add_string_to_array(TALLOC_CTX *mem_ctx, - const char *str, const char ***strings, int *num) -{ - char *dup_str = talloc_strdup(mem_ctx, str); - - *strings = talloc_realloc(mem_ctx, - *strings, - const char *, ((*num)+1)); - - if ((*strings == NULL) || (dup_str == NULL)) - return false; - - (*strings)[*num] = dup_str; - *num += 1; - - return true; -} - -/** * Parse a string containing a boolean value. * * val will be set to the read value. @@ -259,36 +235,6 @@ _PUBLIC_ bool conv_str_u64(const char * str, uint64_t * val) } /** -Do a case-insensitive, whitespace-ignoring string compare. -**/ -_PUBLIC_ int strwicmp(const char *psz1, const char *psz2) -{ - /* if BOTH strings are NULL, return TRUE, if ONE is NULL return */ - /* appropriate value. */ - if (psz1 == psz2) - return (0); - else if (psz1 == NULL) - return (-1); - else if (psz2 == NULL) - return (1); - - /* sync the strings on first non-whitespace */ - while (1) { - while (isspace((int)*psz1)) - psz1++; - while (isspace((int)*psz2)) - psz2++; - if (toupper((unsigned char)*psz1) != toupper((unsigned char)*psz2) - || *psz1 == '\0' - || *psz2 == '\0') - break; - psz1++; - psz2++; - } - return (*psz1 - *psz2); -} - -/** * Compare 2 strings. * * @note The comparison is case-insensitive. |