]>
Commit | Line | Data |
---|---|---|
717fd8f6 AF |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 6.2.101 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 6.2.101 | |
11 | Problem: When using syntax folding, opening a file slows down a lot when | |
12 | it's size increases by only 20%. (Gary Johnson) | |
13 | Solution: The array with cached syntax states is leaking entries. After | |
14 | cleaning up the list obtain the current entry again. | |
15 | Files: src/syntax.c | |
16 | ||
17 | ||
18 | *** ../vim-6.2.100/src/syntax.c Sun Aug 10 14:52:30 2003 | |
19 | --- src/syntax.c Sat Sep 27 17:03:24 2003 | |
20 | *************** | |
21 | *** 1088,1094 **** | |
22 | { | |
23 | /* When shrinking the array, cleanup the existing stack. | |
24 | * Make sure that all valid entries fit in the new array. */ | |
25 | ! while (syn_buf->b_sst_len - syn_buf->b_sst_freecount + 2> len | |
26 | && syn_stack_cleanup()) | |
27 | ; | |
28 | if (len < syn_buf->b_sst_len - syn_buf->b_sst_freecount + 2) | |
29 | --- 1088,1094 ---- | |
30 | { | |
31 | /* When shrinking the array, cleanup the existing stack. | |
32 | * Make sure that all valid entries fit in the new array. */ | |
33 | ! while (syn_buf->b_sst_len - syn_buf->b_sst_freecount + 2 > len | |
34 | && syn_stack_cleanup()) | |
35 | ; | |
36 | if (len < syn_buf->b_sst_len - syn_buf->b_sst_freecount + 2) | |
37 | *************** | |
38 | *** 1322,1335 **** | |
39 | { | |
40 | if (sp != NULL) | |
41 | { | |
42 | ! /* find the entry just before this one */ | |
43 | ! for (p = syn_buf->b_sst_first; p != NULL; p = p->sst_next) | |
44 | ! if (p->sst_next == sp) | |
45 | ! break; | |
46 | ! if (p != NULL) | |
47 | ! p->sst_next = sp->sst_next; | |
48 | ! else | |
49 | syn_buf->b_sst_first = sp->sst_next; | |
50 | syn_stack_free_entry(syn_buf, sp); | |
51 | sp = NULL; | |
52 | } | |
53 | --- 1322,1339 ---- | |
54 | { | |
55 | if (sp != NULL) | |
56 | { | |
57 | ! /* find "sp" in the list and remove it */ | |
58 | ! if (syn_buf->b_sst_first == sp) | |
59 | ! /* it's the first entry */ | |
60 | syn_buf->b_sst_first = sp->sst_next; | |
61 | + else | |
62 | + { | |
63 | + /* find the entry just before this one to adjust sst_next */ | |
64 | + for (p = syn_buf->b_sst_first; p != NULL; p = p->sst_next) | |
65 | + if (p->sst_next == sp) | |
66 | + break; | |
67 | + p->sst_next = sp->sst_next; | |
68 | + } | |
69 | syn_stack_free_entry(syn_buf, sp); | |
70 | sp = NULL; | |
71 | } | |
72 | *************** | |
73 | *** 1341,1347 **** | |
74 | --- 1345,1355 ---- | |
75 | */ | |
76 | /* If no free items, cleanup the array first. */ | |
77 | if (syn_buf->b_sst_freecount == 0) | |
78 | + { | |
79 | (void)syn_stack_cleanup(); | |
80 | + /* "sp" may have been moved to the freelist now */ | |
81 | + sp = syn_stack_find_entry(current_lnum); | |
82 | + } | |
83 | /* Still no free items? Must be a strange problem... */ | |
84 | if (syn_buf->b_sst_freecount == 0) | |
85 | sp = NULL; | |
86 | *** ../vim-6.2.100/src/version.c Sat Sep 27 19:20:53 2003 | |
87 | --- src/version.c Sat Sep 27 19:24:52 2003 | |
88 | *************** | |
89 | *** 632,633 **** | |
90 | --- 638,641 ---- | |
91 | { /* Add new patch number below this line */ | |
92 | + /**/ | |
93 | + 101, | |
94 | /**/ | |
95 | ||
96 | -- | |
97 | Have you heard about the new Beowulf cluster? It's so fast, it executes | |
98 | an infinite loop in 6 seconds. | |
99 | ||
100 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
101 | /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ | |
102 | \\\ Project leader for A-A-P -- http://www.A-A-P.org /// | |
103 | \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html /// |