[Commits] textview.c 1.96.2.249 1.96.2.250 textview.h 1.12.2.35 1.12.2.36

colin at claws-mail.org colin at claws-mail.org
Thu Oct 25 09:42:10 CEST 2012


Update of /home/claws-mail/claws/src
In directory srv:/tmp/cvs-serv5431/src

Modified Files:
      Tag: gtk2
	textview.c textview.h 
Log Message:
2012-10-25 [colin]	3.8.1cvs104

	* src/textview.c
	* src/textview.h
		Avoid strlen() on big buffers, use precomputed length instead
		it reduces cost of textview_write_line() from 32% to 3% for
		big messages. Patch by Igor Mammedov
	* AUTHORS
	* src/gtk/authors.h
		Add Igor

Index: textview.c
===================================================================
RCS file: /home/claws-mail/claws/src/textview.c,v
retrieving revision 1.96.2.249
retrieving revision 1.96.2.250
diff -u -d -r1.96.2.249 -r1.96.2.250
--- textview.c	19 Sep 2012 12:22:24 -0000	1.96.2.249
+++ textview.c	25 Oct 2012 07:42:07 -0000	1.96.2.250
@@ -1637,6 +1637,7 @@
 			uri = g_new0(ClickableText, 1);
 			uri->uri = g_strdup("");
 			uri->data = g_strdup(buf);
+			uri->data_len = strlen(uri->data);
 			uri->start = gtk_text_iter_get_offset(&iter);
 			uri->is_quote = TRUE;
 			uri->quote_level = real_quotelevel;
@@ -1669,11 +1670,12 @@
 					textview->prev_quote_level = -1;
 					goto do_quote;
 				}
-				e_len = lasturi->data ? strlen(lasturi->data):0;
+				e_len = lasturi->data ? lasturi->data_len:0;
 				n_len = strlen(buf);
 				lasturi->data = g_realloc((gchar *)lasturi->data, e_len + n_len + 1);
 				strcpy((gchar *)lasturi->data + e_len, buf);
 				*((gchar *)lasturi->data + e_len + n_len) = '\0';
+				lasturi->data_len += n_len;
 			}
 		}
 	} else {

Index: textview.h
===================================================================
RCS file: /home/claws-mail/claws/src/textview.h,v
retrieving revision 1.12.2.35
retrieving revision 1.12.2.36
diff -u -d -r1.12.2.35 -r1.12.2.36
--- textview.h	8 Sep 2012 20:23:11 -0000	1.12.2.35
+++ textview.h	25 Oct 2012 07:42:07 -0000	1.12.2.36
@@ -35,6 +35,7 @@
 	gchar *filename;
 
 	gpointer data;
+	gint data_len;
 
 	guint start;
 	guint end;



More information about the Commits mailing list