* modest-text-utils.[ch]:
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Wed, 20 Dec 2006 08:17:46 +0000 (08:17 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Wed, 20 Dec 2006 08:17:46 +0000 (08:17 +0000)
  - fixed modest_text_utils_remove_address (impl and doc)

pmo-trunk-r568

src/modest-text-utils.c
src/modest-text-utils.h

index 4262066..5cf47bc 100644 (file)
@@ -213,16 +213,18 @@ modest_text_utils_derived_subject (const gchar *subject, const gchar *prefix)
        }
 }
 
-gchar *
+gchar*
 modest_text_utils_remove_address (const gchar *address_list, const gchar *address)
 {
-       char *dup, *token, *ptr, *result;
+       gchar *dup, *token, *ptr, *result;
        GString *filtered_emails;
 
-       if (!address_list)
-               return NULL;
+       g_return_val_if_fail (address_list, NULL);
 
-       /* Search for substring */
+       if (!address)
+               return g_strdup (address_list);
+       
+       /* search for substring */
        if (!strstr ((const char *) address_list, (const char *) address))
                return g_strdup (address_list);
 
index e07e682..405a231 100644 (file)
@@ -106,12 +106,14 @@ gchar*   modest_text_utils_inline (const gchar *text,
 
 /**
  * modest_text_utils_remove_address
- * @address_list: string with a comma-separated list of email addresses
- * @address: an specific e-mail address
+ * @address_list: none-NULL string with a comma-separated list of email addresses
+ * @address: an specific e-mail address 
  *
- * remove a specific address from a list of email addresses
+ * remove a specific address from a list of email addresses; if @address
+ * is NULL, returns an unchanged @address_list
  * 
- * Returns: a newly allocated string containing the new list
+ * Returns: a newly allocated string containing the new list, or NULL
+ * in case of error or the original @address_list was NULL
  */
 gchar*   modest_text_utils_remove_address (const gchar *address_list, 
                                           const gchar *address);