using while cycle instead of g_strrstr, because g_strrstr doesn't work properly. g_strrstr finds the last '(' of the string, not the line.

Tue, 26 Jun 2007 09:50:40 +0000

author
Michael Shkutkov <mshkutkov@soc.pidgin.im>
date
Tue, 26 Jun 2007 09:50:40 +0000
changeset 18519
7a6b0327b1a1
parent 18518
e634b818b474
child 18520
bfd97a4c3917

using while cycle instead of g_strrstr, because g_strrstr doesn't work properly. g_strrstr finds the last '(' of the string, not the line.

libpurple/plugins/log_reader.c file | annotate | diff | comparison | revisions
--- a/libpurple/plugins/log_reader.c	Mon Jun 25 00:47:02 2007 +0000
+++ b/libpurple/plugins/log_reader.c	Tue Jun 26 09:50:40 2007 +0000
@@ -1841,9 +1841,10 @@
 			c++;
 
 			/* Find the last '(' character. */
-			if ((tmp = strstr(c, "\n")) != NULL)
-				c = g_strrstr(tmp, "(");
-			else {
+			if ((tmp = strstr(c, "\n")) != NULL) {
+				while (*tmp && *tmp != '(') --tmp;
+				c = tmp;
+			} else {
 				while (*c)
 					c++;
 				c--;
@@ -1901,11 +1902,10 @@
 							start_log = new_line;
 						}
 					}
-
-					/* find EOF */
-					c = strstr(c, "\n");
-					c++;
 				}
+				/* find EOF */
+				c = strstr(c, "\n");
+				c++;
 			}
 		} else {
 			c = strstr(c, "\n");
@@ -1996,9 +1996,10 @@
 			buddy_name = ++c;
 
 			/* Find the last '(' character. */
-			if ((tmp = strstr(c, "\n")) != NULL)
-				c = g_strrstr(tmp, "(");
-			else {
+			if ((tmp = strstr(c, "\n")) != NULL) {
+				while (*tmp && *tmp != '(') --tmp;
+				c = tmp;
+			} else {
 				while (*c)
 					c++;
 				c--;

mercurial