[Commits] utils.c 1.36.2.207 1.36.2.208 utils.h 1.20.2.82 1.20.2.83
colin at claws-mail.org
colin at claws-mail.org
Thu Oct 25 09:45:01 CEST 2012
Update of /home/claws-mail/claws/src/common
In directory srv:/tmp/cvs-serv8174/src/common
Modified Files:
Tag: gtk2
utils.c utils.h
Log Message:
2012-10-25 [colin] 3.8.1cvs106
* src/common/utils.c
* src/common/utils.h
* src/textview.c
Avoid strlen() on inner loop in textview_make_clickable_parts*()
reduces cost of strcasestr() in textview_make_clickable_parts*()
from 30% to 15%. Patch by Igor Mammedov
Index: utils.c
===================================================================
RCS file: /home/claws-mail/claws/src/common/utils.c,v
retrieving revision 1.36.2.207
retrieving revision 1.36.2.208
diff -u -d -r1.36.2.207 -r1.36.2.208
--- utils.c 12 Oct 2012 15:13:17 -0000 1.36.2.207
+++ utils.c 25 Oct 2012 07:44:59 -0000 1.36.2.208
@@ -534,9 +534,15 @@
/* Similar to `strstr' but this function ignores the case of both strings. */
gchar *strcasestr(const gchar *haystack, const gchar *needle)
{
- register size_t haystack_len, needle_len;
+ size_t haystack_len = strlen(haystack);
+
+ return strncasestr(haystack, haystack_len, needle);
+}
+
+gchar *strncasestr(const gchar *haystack, gint haystack_len, const gchar *needle)
+{
+ register size_t needle_len;
- haystack_len = strlen(haystack);
needle_len = strlen(needle);
if (haystack_len < needle_len || needle_len == 0)
Index: utils.h
===================================================================
RCS file: /home/claws-mail/claws/src/common/utils.h,v
retrieving revision 1.20.2.82
retrieving revision 1.20.2.83
diff -u -d -r1.20.2.82 -r1.20.2.83
--- utils.h 12 Oct 2012 15:13:17 -0000 1.20.2.82
+++ utils.h 25 Oct 2012 07:44:59 -0000 1.20.2.83
@@ -309,6 +309,9 @@
gint file_strip_crs (const gchar *file);
gchar *strcasestr (const gchar *haystack,
const gchar *needle);
+gchar *strncasestr (const gchar *haystack,
+ gint haystack_len,
+ const gchar *needle);
gpointer my_memmem (gconstpointer haystack,
size_t haystacklen,
gconstpointer needle,
More information about the Commits
mailing list