~ubuntu-branches/ubuntu/vivid/mutt/vivid-updates

« back to all changes in this revision

Viewing changes to debian/patches/fix-search-performance-regression.patch

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2015-10-01 15:27:35 UTC
  • Revision ID: package-import@ubuntu.com-20151001152735-yyjhtk4o0qchwd64
Tags: 1.5.23-3ubuntu1
import fix-search-performance-regression.patch from upstream (LP: #1483796)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Fix performance regression for ~b/~B searching. (closes #3743)
 
2
 
 
3
In mutt_is_autoview(), changeset b58cdfacfb89 introduced a call to
 
4
rfc1524_mailcap_lookup() before checking if the MIME type should
 
5
be autoviewed based on the user's preferences. This caused a major
 
6
performance regression for ~b/~B searching.
 
7
 
 
8
Rearrange mutt_is_autoview() to check the user preferences first, then
 
9
search for a mailcap entry only if the MIME type should be autoviewed.
 
10
 
 
11
In order to preserve correct mime_lookup behavior, re-add a call to
 
12
mutt_check_lookup_list() before scanning the AutoViewList.
 
13
 
 
14
diff -r 067a3ac42c3b -r 755a18da99bc handler.c
 
15
--- a/handler.c Sun Apr 19 13:15:50 2015 -0700
 
16
+++ b/handler.c Sat Apr 25 19:00:13 2015 -0700
 
17
@@ -955,36 +955,38 @@
 
18
 static int mutt_is_autoview (BODY *b)
 
19
 {
 
20
   char type[SHORT_STRING];
 
21
+  int is_autoview = 0;
 
22
 
 
23
   snprintf (type, sizeof (type), "%s/%s", TYPE (b), b->subtype);
 
24
 
 
25
+  if (option(OPTIMPLICITAUTOVIEW))
 
26
+  {
 
27
+    /* $implicit_autoview is essentially the same as "auto_view *" */
 
28
+    is_autoview = 1;
 
29
+  }
 
30
+  else
 
31
+  {
 
32
+    /* determine if this type is on the user's auto_view list */
 
33
+    LIST *t = AutoViewList;
 
34
+
 
35
+    mutt_check_lookup_list (b, type, sizeof (type));
 
36
+    for (; t; t = t->next) {
 
37
+      int i = mutt_strlen (t->data) - 1;
 
38
+      if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' && 
 
39
+            ascii_strncasecmp (type, t->data, i) == 0) ||
 
40
+          ascii_strcasecmp (type, t->data) == 0)
 
41
+        is_autoview = 1;
 
42
+    }
 
43
+
 
44
+    if (is_mmnoask (type))
 
45
+      is_autoview = 1;
 
46
+  }
 
47
+
 
48
   /* determine if there is a mailcap entry suitable for auto_view
 
49
    *
 
50
-   * WARNING: _type is altered by this call as a result of `mime_lookup' support */
 
51
-  if (rfc1524_mailcap_lookup(b, type, NULL, M_AUTOVIEW))
 
52
-  {
 
53
-    if (option(OPTIMPLICITAUTOVIEW))
 
54
-    {
 
55
-      /* $implicit_autoview is essentially the same as "auto_view *" */
 
56
-      return 1;
 
57
-    }
 
58
-    else
 
59
-    {
 
60
-      /* determine if this type is on the user's auto_view list */
 
61
-      LIST *t = AutoViewList;
 
62
-
 
63
-      for (; t; t = t->next) {
 
64
-       int i = mutt_strlen (t->data) - 1;
 
65
-       if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' && 
 
66
-             ascii_strncasecmp (type, t->data, i) == 0) ||
 
67
-           ascii_strcasecmp (type, t->data) == 0)
 
68
-         return 1;
 
69
-      }
 
70
-
 
71
-      if (is_mmnoask (type))
 
72
-       return 1;
 
73
-    }
 
74
-  }
 
75
+   * WARNING: type is altered by this call as a result of `mime_lookup' support */
 
76
+  if (is_autoview)
 
77
+    return rfc1524_mailcap_lookup(b, type, NULL, M_AUTOVIEW);
 
78
 
 
79
   return 0;
 
80
 }