[Commits] [SCM] claws branch, master, updated. 3.16.0-259-g3833339

ticho at claws-mail.org ticho at claws-mail.org
Mon Aug 13 20:34:11 CEST 2018


The branch, master has been updated
       via  383333946dda94ea8490bccbb5322113894bf2c1 (commit)
      from  d8525e5d8d71ac89fb0db7e7a2a0a1dae6a8cf51 (commit)

Summary of changes:
 src/plugins/rssyl/strutils.c |   17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)


- Log -----------------------------------------------------------------
commit 383333946dda94ea8490bccbb5322113894bf2c1
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Mon Aug 13 20:32:49 2018 +0200

    Return a copy of the string also when sanity checks fail.
    
    Also, use GLib's g_return functions instead of ifs and
    debug_prints.

diff --git a/src/plugins/rssyl/strutils.c b/src/plugins/rssyl/strutils.c
index b455a75..96b05a1 100644
--- a/src/plugins/rssyl/strutils.c
+++ b/src/plugins/rssyl/strutils.c
@@ -47,20 +47,11 @@ gchar *rssyl_strreplace(gchar *source, gchar *pattern,
 			replacement);
 	*/
 
-	if( source == NULL || pattern == NULL ) {
-		debug_print("RSSyl: source or pattern is NULL!!!\n");
-		return source;
-	}
-
-	if( !g_utf8_validate(source, -1, NULL) ) {
-		debug_print("RSSyl: source is not an UTF-8 encoded text\n");
-		return source;
-	}
+	g_return_val_if_fail(source != NULL, g_strdup(source));
+	g_return_val_if_fail(pattern != NULL, g_strdup(source));
 
-	if( !g_utf8_validate(pattern, -1, NULL) ) {
-		debug_print("RSSyl: pattern is not an UTF-8 encoded text\n");
-		return source;
-	}
+	g_return_val_if_fail(g_utf8_validate(source, -1, NULL), g_strdup(source));
+	g_return_val_if_fail(g_utf8_validate(pattern, -1, NULL), g_strdup(source));
 
 	len_pattern = strlen(pattern);
 	len_replacement = strlen(replacement);

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list