]> git.pld-linux.org Git - packages/vim.git/blob - 7.0.192
- new
[packages/vim.git] / 7.0.192
1 To: vim-dev@vim.org
2 Subject: patch 7.0.192
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 7.0.192
11 Problem:    When 'swapfile' is switched off in an empty file it is possible
12             that not all blocks are loaded into memory, causing ml_get errors
13             later.
14 Solution:   Rename "dont_release" to "mf_dont_release" and also use it to
15             avoid using the cached line and locked block. 
16 Files:      src/globals.h, src/memfile.c, src/memline.c
17
18
19 *** ../vim-7.0.191/src/globals.h        Tue Jan  9 15:15:36 2007
20 --- src/globals.h       Wed Feb  7 03:29:52 2007
21 ***************
22 *** 554,559 ****
23 --- 554,563 ----
24   EXTERN buf_T  *firstbuf INIT(= NULL); /* first buffer */
25   EXTERN buf_T  *lastbuf INIT(= NULL);  /* last buffer */
26   EXTERN buf_T  *curbuf INIT(= NULL);   /* currently active buffer */
27
28 + /* Flag that is set when switching off 'swapfile'.  It means that all blocks
29 +  * are to be loaded into memory.  Shouldn't be global... */
30 + EXTERN int    mf_dont_release INIT(= FALSE);  /* don't release blocks */
31   
32   /*
33    * List of files being edited (global argument list).  curwin->w_alist points
34 *** ../vim-7.0.191/src/memfile.c        Tue Nov  7 18:02:19 2006
35 --- src/memfile.c       Wed Feb  7 03:22:11 2007
36 ***************
37 *** 76,82 ****
38   #define MEMFILE_PAGE_SIZE 4096                /* default page size */
39   
40   static long_u total_mem_used = 0;     /* total memory used for memfiles */
41 - static int    dont_release = FALSE;   /* don't release blocks */
42   
43   static void mf_ins_hash __ARGS((memfile_T *, bhdr_T *));
44   static void mf_rem_hash __ARGS((memfile_T *, bhdr_T *));
45 --- 76,81 ----
46 ***************
47 *** 279,288 ****
48       if (getlines)
49       {
50         /* get all blocks in memory by accessing all lines (clumsy!) */
51 !       dont_release = TRUE;
52         for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum)
53             (void)ml_get_buf(buf, lnum, FALSE);
54 !       dont_release = FALSE;
55         /* TODO: should check if all blocks are really in core */
56       }
57   
58 --- 278,287 ----
59       if (getlines)
60       {
61         /* get all blocks in memory by accessing all lines (clumsy!) */
62 !       mf_dont_release = TRUE;
63         for (lnum = 1; lnum <= buf->b_ml.ml_line_count; ++lnum)
64             (void)ml_get_buf(buf, lnum, FALSE);
65 !       mf_dont_release = FALSE;
66         /* TODO: should check if all blocks are really in core */
67       }
68   
69 ***************
70 *** 830,836 ****
71       buf_T     *buf;
72   
73       /* don't release while in mf_close_file() */
74 !     if (dont_release)
75         return NULL;
76   
77       /*
78 --- 829,835 ----
79       buf_T     *buf;
80   
81       /* don't release while in mf_close_file() */
82 !     if (mf_dont_release)
83         return NULL;
84   
85       /*
86 *** ../vim-7.0.191/src/memline.c        Tue Jan  9 15:15:36 2007
87 --- src/memline.c       Wed Feb  7 03:29:31 2007
88 ***************
89 *** 2074,2081 ****
90   /*
91    * See if it is the same line as requested last time.
92    * Otherwise may need to flush last used line.
93    */
94 !     if (buf->b_ml.ml_line_lnum != lnum)
95       {
96         ml_flush_line(buf);
97   
98 --- 2074,2083 ----
99   /*
100    * See if it is the same line as requested last time.
101    * Otherwise may need to flush last used line.
102 +  * Don't use the last used line when 'swapfile' is reset, need to load all
103 +  * blocks.
104    */
105 !     if (buf->b_ml.ml_line_lnum != lnum || mf_dont_release)
106       {
107         ml_flush_line(buf);
108   
109 ***************
110 *** 3200,3212 ****
111        * If not, flush and release the locked block.
112        * Don't do this for ML_INSERT_SAME, because the stack need to be updated.
113        * Don't do this for ML_FLUSH, because we want to flush the locked block.
114        */
115       if (buf->b_ml.ml_locked)
116       {
117 !       if (ML_SIMPLE(action) && buf->b_ml.ml_locked_low <= lnum
118 !                                         && buf->b_ml.ml_locked_high >= lnum)
119         {
120 !               /* remember to update pointer blocks and stack later */
121             if (action == ML_INSERT)
122             {
123                 ++(buf->b_ml.ml_locked_lineadd);
124 --- 3202,3217 ----
125        * If not, flush and release the locked block.
126        * Don't do this for ML_INSERT_SAME, because the stack need to be updated.
127        * Don't do this for ML_FLUSH, because we want to flush the locked block.
128 +      * Don't do this when 'swapfile' is reset, we want to load all the blocks.
129        */
130       if (buf->b_ml.ml_locked)
131       {
132 !       if (ML_SIMPLE(action)
133 !               && buf->b_ml.ml_locked_low <= lnum
134 !               && buf->b_ml.ml_locked_high >= lnum
135 !               && !mf_dont_release)
136         {
137 !           /* remember to update pointer blocks and stack later */
138             if (action == ML_INSERT)
139             {
140                 ++(buf->b_ml.ml_locked_lineadd);
141 *** ../vim-7.0.191/src/version.c        Sun Feb  4 02:59:04 2007
142 --- src/version.c       Wed Feb  7 03:40:28 2007
143 ***************
144 *** 668,669 ****
145 --- 668,671 ----
146   {   /* Add new patch number below this line */
147 + /**/
148 +     192,
149   /**/
150
151 -- 
152 From "know your smileys":
153  %-)    After staring at screen for 15 hours
154
155  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
156 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
157 \\\        download, build and distribute -- http://www.A-A-P.org        ///
158  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.044587 seconds and 3 git commands to generate.