diff options
author | Michael Zucci <zucchi@src.gnome.org> | 2000-05-03 04:37:06 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-05-03 04:37:06 +0800 |
commit | 44575d972d94ce00b0e7c5d46bbb59761d5c840d (patch) | |
tree | d2624f4d14afb5aebc8b2ef0f323db27258a5080 /camel/string-utils.c | |
parent | cf99b8eec231365fedce7d7930ded14334da3741 (diff) | |
download | gsoc2013-evolution-44575d972d94ce00b0e7c5d46bbb59761d5c840d.tar.gz gsoc2013-evolution-44575d972d94ce00b0e7c5d46bbb59761d5c840d.tar.zst gsoc2013-evolution-44575d972d94ce00b0e7c5d46bbb59761d5c840d.zip |
> * gmime-utils.[ch]: What the hell, remove it. This will break the
> nntp provider (but its broken anyway). The mime parser can be
> used instead though.
> Removed from all code including it (but none were using it).
>
> * gmime-utils.c (_store_header_pair_from_string): Removed bizarre
> string_dichotomy version of this. This code is somewhat redundant
> now, and is headed for death anyway.
>
> * gstring-util.c (g_string_dichotomy): Same with this one.
> (g_string_clone): Removed a memory leak, g_string_new() allocates
> its own memory.
> (g_string_append_g_string): Allow to append an empty gstring onto
> another gstring, dont abort()!
>
> * string-utils.c (string_dichotomy): Removed this incredibly weird
> function.
>
> * camel-folder.c (_create): Replaced the rather obtuse use of
> "string_dichotomy" function with a simple strrchr(). Still not
> sure it'll work.
>
> * camel-folder-summary.c: cvs removed a long-removed file.
svn path=/trunk/; revision=2753
Diffstat (limited to 'camel/string-utils.c')
-rw-r--r-- | camel/string-utils.c | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/camel/string-utils.c b/camel/string-utils.c index 039aafe2b8..42fb93538a 100644 --- a/camel/string-utils.c +++ b/camel/string-utils.c @@ -24,122 +24,16 @@ * USA */ - - #include <config.h> #include "string-utils.h" #include "string.h" - - gboolean string_equal_for_glist (gconstpointer v, gconstpointer v2) { return (!strcmp ( ((const gchar *)v), ((const gchar*)v2))) == 0; } -/** - * string_dichotomy: - * @sep : separator - * @prefix: pointer to be field by the prefix object - * the prefix is not returned when the given pointer is NULL - * @suffix: pointer to be field by the suffix object - * the suffix is not returned when the given pointer is NULL - * - * Return the strings before and/or after - * the last occurence of the specified separator - * - * This routine returns the string before and/or after - * a character given as an argument. - * if the separator is the last character, prefix and/or - * suffix is set to NULL and result is set to 'l' - * if the separator is not in the list, prefix and/or - * suffix is set to NULL and result is set to 'n' - * When the operation succedeed, the return value is 'o' - * - * @Return Value : result of the operation ('o', 'l' or 'n') - * - **/ -gchar -string_dichotomy (const gchar *string, gchar sep, gchar **prefix, gchar **suffix, - StringDichotomyOption options) -{ - gint sep_pos, first, last, len; - - g_assert (string); - len = strlen (string); - if (!len) { - if (prefix) - *prefix=NULL; - if (suffix) - *suffix=NULL; - return 'n'; - } - first = 0; - last = len-1; - - if ( (options & STRING_DICHOTOMY_STRIP_LEADING ) && (string[first] == sep) ) - do {first++;} while ( (first<len) && (string[first] == sep) ); - - if (options & STRING_DICHOTOMY_STRIP_TRAILING ) - while ((string[last] == sep) && (last>first)) - last--; - - if (first==last) { - if (prefix) *prefix=NULL; - if (suffix) *suffix=NULL; - return 'n'; - } - - if (options & STRING_DICHOTOMY_RIGHT_DIR) { - sep_pos = last; - while ((sep_pos>=first) && (string[sep_pos]!=sep)) { - sep_pos--; - } - } else { - sep_pos = first; - while ((sep_pos<=last) && (string[sep_pos]!=sep)) { - sep_pos++; - } - - } - - if ( (sep_pos<first) || (sep_pos>last) ) - { - if (suffix) *suffix=NULL; - if (prefix) *prefix=NULL; - return 'n'; - } - - /* if we have stripped trailing separators, we should */ - /* never enter here */ - if (sep_pos==last) - { - if (suffix) *suffix=NULL; - if (prefix) *prefix=NULL; - return 'l'; - } - /* if we have stripped leading separators, we should */ - /* never enter here */ - if (sep_pos==first) - { - if (suffix) *suffix=NULL; - if (prefix) *prefix=NULL; - return 'l'; - } - if (prefix) - *prefix = g_strndup (string+first,sep_pos-first); - if (suffix) - *suffix = g_strndup (string+sep_pos+1, last-sep_pos); - - return 'o'; -} - - - - - - /* utility func : frees a gchar element in a GList */ static void __string_list_free_string (gpointer data, gpointer user_data) @@ -148,7 +42,6 @@ __string_list_free_string (gpointer data, gpointer user_data) g_free (string); } - void string_list_free (GList *string_list) { |