SF.net SVN: geany:[5965] trunk

colombanw at users.sourceforge.net colombanw at xxxxx
Wed Sep 28 19:49:29 UTC 2011


Revision: 5965
          http://geany.svn.sourceforge.net/geany/?rev=5965&view=rev
Author:   colombanw
Date:     2011-09-28 19:49:28 +0000 (Wed, 28 Sep 2011)
Log Message:
-----------
Fix utils_string_replace_all() to accept a NULL replacement again

Support of NULL as the replacement was lost in the code refactoring
introduced by revision 5730, and it broke a few plugins.

Revision Links:
--------------
    http://geany.svn.sourceforge.net/geany/?rev=5730&view=rev

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/utils.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2011-09-28 10:47:43 UTC (rev 5964)
+++ trunk/ChangeLog	2011-09-28 19:49:28 UTC (rev 5965)
@@ -1,3 +1,9 @@
+2011-09-28  Colomban Wendling  <colomban(at)geany(dot)org>
+
+ * src/utils.c:
+   Fix utils_string_replace_all() to accept a NULL replacement again.
+
+
 2011-09-26  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/editor.c:

Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2011-09-28 10:47:43 UTC (rev 5964)
+++ trunk/src/utils.c	2011-09-28 19:49:28 UTC (rev 5965)
@@ -1556,9 +1556,13 @@
 gint utils_string_replace(GString *str, gint pos, gint len, const gchar *replace)
 {
 	g_string_erase(str, pos, len);
-	g_string_insert(str, pos, replace);
+	if (replace)
+	{
+		g_string_insert(str, pos, replace);
+		pos += strlen(replace);
+	}
 
-	return pos + strlen(replace);
+	return pos;
 }
 
 

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list