[PATCH] : speed up



	Hi all,
a straightforward few-liners to correct abuse of strlen in spell-check.c.
Bye
Manu
--- balsa-1.2.1/src/spell-check.c	Wed Jul 25 11:19:35 2001
+++ balsa-1.2.1-cleanup/src/spell-check.c	Fri Oct 26 10:51:02 2001
@@ -1286,13 +1286,14 @@
 
     /* match the next word */
     if (!at_end && line) {
+	guint line_len=strlen(line);
 #ifdef HAVE_PCRE
 	rm[0] = rm[1] = 0;
-	pcre_exec(new_word_rex, NULL, line, strlen(line), 0, 0, rm ,3);
+	pcre_exec(new_word_rex, NULL, line, line_len, 0, 0, rm ,3);
 
 	if (rm[0] == rm[1]) {
-	    spell_check->start_pos += strlen(line) + offset;
-	    spell_check->end_pos += strlen(line) + offset;
+	    spell_check->start_pos += line_len + offset;
+	    spell_check->end_pos += line_len + offset;
 	    in_line = FALSE;
 	} else {
 	    spell_check->start_pos += (rm[0] + offset);
@@ -1305,8 +1306,8 @@
 	regexec(new_word_rex, line, 1, &rm, 0);
 
 	if (rm.rm_so == rm.rm_eo) {
-	    spell_check->start_pos += strlen(line) + offset;
-	    spell_check->end_pos += strlen(line) + offset;
+	    spell_check->start_pos += line_len + offset;
+	    spell_check->end_pos += line_len + offset;
 	    in_line = FALSE;
 	} else {
 	    spell_check->start_pos += (rm.rm_so + offset);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]