]> git.pld-linux.org Git - packages/vim.git/blob - 7.1.120
- updated to 7.1.285
[packages/vim.git] / 7.1.120
1 To: vim-dev@vim.org
2 Subject: patch 7.1.120
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.1.120
11 Problem:    Can't properly check memory leaks while running tests.
12 Solution:   Add an argument to garbagecollect().  Delete functions and
13             variables in the test scripts.
14 Files:      runtime/doc/eval.txt, src/eval.c, src/globals.h, src/main.c,
15             src/testdir/Makefile, src/testdir/test14.in,
16             src/testdir/test26.in, src/testdir/test34.in,
17             src/testdir/test45.in, src/testdir/test47.in,
18             src/testdir/test49.in, src/testdir/test55.in,
19             src/testdir/test56.in, src/testdir/test58.in,
20             src/testdir/test59.in, src/testdir/test60.in,
21             src/testdir/test60.vim, src/testdir/test62.in,
22             src/testdir/test63.in, src/testdir/test64.in
23
24
25 *** ../vim-7.1.119/runtime/doc/eval.txt Thu Jul 26 22:55:11 2007
26 --- runtime/doc/eval.txt        Tue Sep 25 17:40:30 2007
27 ***************
28 *** 1,4 ****
29 ! *eval.txt*      For Vim version 7.1.  Last change: 2007 Jul 25
30   
31   
32                   VIM REFERENCE MANUAL    by Bram Moolenaar
33 --- 1,4 ----
34 ! *eval.txt*      For Vim version 7.1.  Last change: 2007 Sep 25
35   
36   
37                   VIM REFERENCE MANUAL    by Bram Moolenaar
38 ***************
39 *** 1603,1609 ****
40   foldtextresult( {lnum})               String  text for closed fold at {lnum}
41   foreground( )                 Number  bring the Vim window to the foreground
42   function( {name})             Funcref reference to function {name}
43 ! garbagecollect()              none    free memory, breaking cyclic references
44   get( {list}, {idx} [, {def}]) any     get item {idx} from {list} or {def}
45   get( {dict}, {key} [, {def}]) any     get item {key} from {dict} or {def}
46   getbufline( {expr}, {lnum} [, {end}])
47 --- 1603,1609 ----
48   foldtextresult( {lnum})               String  text for closed fold at {lnum}
49   foreground( )                 Number  bring the Vim window to the foreground
50   function( {name})             Funcref reference to function {name}
51 ! garbagecollect( [at_exit])    none    free memory, breaking cyclic references
52   get( {list}, {idx} [, {def}]) any     get item {idx} from {list} or {def}
53   get( {dict}, {key} [, {def}]) any     get item {key} from {dict} or {def}
54   getbufline( {expr}, {lnum} [, {end}])
55 ***************
56 *** 2673,2679 ****
57                 {name} can be a user defined function or an internal function.
58   
59   
60 ! garbagecollect()                                      *garbagecollect()*
61                 Cleanup unused |Lists| and |Dictionaries| that have circular
62                 references.  There is hardly ever a need to invoke this
63                 function, as it is automatically done when Vim runs out of
64 --- 2673,2679 ----
65                 {name} can be a user defined function or an internal function.
66   
67   
68 ! garbagecollect([at_exit])                             *garbagecollect()*
69                 Cleanup unused |Lists| and |Dictionaries| that have circular
70                 references.  There is hardly ever a need to invoke this
71                 function, as it is automatically done when Vim runs out of
72 ***************
73 *** 2683,2688 ****
74 --- 2683,2691 ----
75                 This is useful if you have deleted a very big |List| and/or
76                 |Dictionary| with circular references in a script that runs
77                 for a long time.
78 +               When the optional "at_exit" argument is one, garbage
79 +               collection will also be done when exiting Vim, if it wasn't
80 +               done before.  This is useful when checking for memory leaks.
81   
82   get({list}, {idx} [, {default}])                      *get()*
83                 Get item {idx} from |List| {list}.  When this item is not
84 *** ../vim-7.1.119/src/eval.c   Tue Sep 25 12:50:00 2007
85 --- src/eval.c  Sun Sep 16 19:24:49 2007
86 ***************
87 *** 6128,6133 ****
88 --- 6128,6134 ----
89       /* Only do this once. */
90       want_garbage_collect = FALSE;
91       may_garbage_collect = FALSE;
92 +     garbage_collect_at_exit = FALSE;
93   
94       /*
95        * 1. Go through all accessible variables and mark all lists and dicts
96 ***************
97 *** 7110,7116 ****
98       {"foldtextresult",        1, 1, f_foldtextresult},
99       {"foreground",    0, 0, f_foreground},
100       {"function",      1, 1, f_function},
101 !     {"garbagecollect",        0, 0, f_garbagecollect},
102       {"get",           2, 3, f_get},
103       {"getbufline",    2, 3, f_getbufline},
104       {"getbufvar",     2, 2, f_getbufvar},
105 --- 7111,7117 ----
106       {"foldtextresult",        1, 1, f_foldtextresult},
107       {"foreground",    0, 0, f_foreground},
108       {"function",      1, 1, f_function},
109 !     {"garbagecollect",        0, 1, f_garbagecollect},
110       {"get",           2, 3, f_get},
111       {"getbufline",    2, 3, f_getbufline},
112       {"getbufvar",     2, 2, f_getbufvar},
113 ***************
114 *** 9719,9724 ****
115 --- 9720,9728 ----
116       /* This is postponed until we are back at the toplevel, because we may be
117        * using Lists and Dicts internally.  E.g.: ":echo [garbagecollect()]". */
118       want_garbage_collect = TRUE;
119
120 +     if (argvars[0].v_type != VAR_UNKNOWN && get_tv_number(&argvars[0]) == 1)
121 +       garbage_collect_at_exit = TRUE;
122   }
123   
124   /*
125 *** ../vim-7.1.119/src/globals.h        Thu Aug 30 13:51:52 2007
126 --- src/globals.h       Sun Sep 16 18:42:41 2007
127 ***************
128 *** 301,313 ****
129   #endif
130   
131   #ifdef FEAT_EVAL
132 ! /* Garbage collection can only take place when we are sure there are no Lists
133    * or Dictionaries being used internally.  This is flagged with
134    * "may_garbage_collect" when we are at the toplevel.
135    * "want_garbage_collect" is set by the garbagecollect() function, which means
136 !  * we do garbage collection before waiting for a char at the toplevel. */
137   EXTERN int    may_garbage_collect INIT(= FALSE);
138   EXTERN int    want_garbage_collect INIT(= FALSE);
139   
140   /* ID of script being sourced or was sourced to define the current function. */
141   EXTERN scid_T current_SID INIT(= 0);
142 --- 301,317 ----
143   #endif
144   
145   #ifdef FEAT_EVAL
146 ! /*
147 !  * Garbage collection can only take place when we are sure there are no Lists
148    * or Dictionaries being used internally.  This is flagged with
149    * "may_garbage_collect" when we are at the toplevel.
150    * "want_garbage_collect" is set by the garbagecollect() function, which means
151 !  * we do garbage collection before waiting for a char at the toplevel.
152 !  * "garbage_collect_at_exit" indicates garbagecollect(1) was called.
153 !  */
154   EXTERN int    may_garbage_collect INIT(= FALSE);
155   EXTERN int    want_garbage_collect INIT(= FALSE);
156 + EXTERN int    garbage_collect_at_exit INIT(= FALSE);
157   
158   /* ID of script being sourced or was sourced to define the current function. */
159   EXTERN scid_T current_SID INIT(= 0);
160 *** ../vim-7.1.119/src/main.c   Thu Sep  6 17:38:06 2007
161 --- src/main.c  Sun Sep 16 18:44:54 2007
162 ***************
163 *** 1334,1339 ****
164 --- 1334,1343 ----
165   #ifdef FEAT_CSCOPE
166       cs_end();
167   #endif
168 + #ifdef FEAT_EVAL
169 +     if (garbage_collect_at_exit)
170 +       garbage_collect();
171 + #endif
172   
173       mch_exit(exitval);
174   }
175 *** ../vim-7.1.119/src/testdir/Makefile Tue Aug 14 17:28:14 2007
176 --- src/testdir/Makefile        Mon Sep 17 20:04:13 2007
177 ***************
178 *** 6,12 ****
179   
180   # Uncomment this line for using valgrind.
181   # The output goes into a file "valgrind.$PID" (sorry, no test number).
182 ! # VALGRIND = valgrind --tool=memcheck --num-callers=15 --logfile=valgrind
183   
184   SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
185                 test7.out test8.out test9.out test10.out test11.out \
186 --- 6,12 ----
187   
188   # Uncomment this line for using valgrind.
189   # The output goes into a file "valgrind.$PID" (sorry, no test number).
190 ! # VALGRIND = valgrind --tool=memcheck --leak-check=yes --num-callers=15 --logfile=valgrind
191   
192   SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
193                 test7.out test8.out test9.out test10.out test11.out \
194 ***************
195 *** 39,45 ****
196   $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
197   
198   clean:
199 !       -rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim test.ok X* viminfo
200   
201   test1.out: test1.in
202         -rm -f $*.failed tiny.vim small.vim mbyte.vim test.ok X* viminfo
203 --- 39,45 ----
204   $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
205   
206   clean:
207 !       -rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim test.ok X* valgrind.pid* viminfo
208   
209   test1.out: test1.in
210         -rm -f $*.failed tiny.vim small.vim mbyte.vim test.ok X* viminfo
211 ***************
212 *** 65,70 ****
213 --- 65,74 ----
214                 else echo $* NO OUTPUT >>test.log; \
215                 fi"
216         -rm -rf X* test.ok viminfo
217
218 + test49.out: test49.vim
219
220 + test60.out: test60.vim
221   
222   nolog:
223         -echo Test results: >test.log
224 *** ../vim-7.1.119/src/testdir/test14.in        Sun Jun 13 20:24:08 2004
225 --- src/testdir/test14.in       Sun Sep 16 15:57:54 2007
226 ***************
227 *** 18,23 ****
228 --- 18,24 ----
229   : let tt = "o\<C-V>65\<C-V>x42\<C-V>o103 \<C-V>33a\<C-V>xfg\<C-V>o78\<Esc>"
230   :endif
231   :exe "normal " . tt
232 + :unlet tt
233   :.w >>test.out
234   :set vb
235   /^Piece
236 *** ../vim-7.1.119/src/testdir/test26.in        Sun Jun 13 17:05:48 2004
237 --- src/testdir/test26.in       Sun Sep 16 16:54:19 2007
238 ***************
239 *** 37,42 ****
240 --- 37,43 ----
241   :    endif
242   :  endif
243   :endwhile
244 + :unlet i j
245   :'t,$w! test.out
246   :qa!
247   ENDTEST
248 *** ../vim-7.1.119/src/testdir/test34.in        Sun Apr 30 20:46:14 2006
249 --- src/testdir/test34.in       Sun Sep 16 21:25:47 2007
250 ***************
251 *** 52,58 ****
252   ---*---
253   (one
254   (two
255 ! [(one again\e:$-5,$wq! test.out
256   ENDTEST
257   
258   here
259 --- 52,66 ----
260   ---*---
261   (one
262   (two
263 ! [(one again\e:$-5,$w! test.out
264 ! :delfunc Table
265 ! :delfunc Compute
266 ! :delfunc Expr1
267 ! :delfunc Expr2
268 ! :delfunc ListItem
269 ! :delfunc ListReset
270 ! :unlet retval counter
271 ! :q!
272   ENDTEST
273   
274   here
275 *** ../vim-7.1.119/src/testdir/test45.in        Sun Jun 13 19:57:02 2004
276 --- src/testdir/test45.in       Sun Sep 16 18:27:20 2007
277 ***************
278 *** 55,60 ****
279 --- 55,61 ----
280   /kk$
281   :call append("$", foldlevel("."))
282   :/^last/+1,$w! test.out
283 + :delfun Flvl
284   :qa!
285   ENDTEST
286   
287 *** ../vim-7.1.119/src/testdir/test47.in        Sun Jun 13 18:40:29 2004
288 --- src/testdir/test47.in       Sun Sep 16 18:32:03 2007
289 ***************
290 *** 34,39 ****
291 --- 34,40 ----
292   :call append("$", two)
293   :call append("$", three)
294   :$-2,$w! test.out
295 + :unlet one two three
296   :qa!
297   ENDTEST
298   
299 *** ../vim-7.1.119/src/testdir/test49.in        Sun Jun 13 18:10:00 2004
300 --- src/testdir/test49.in       Sun Sep 16 23:30:35 2007
301 ***************
302 *** 1,13 ****
303   This is a test of the script language.
304   
305   If after adding a new test, the test output doesn't appear properly in
306 ! test49.failed, try to add one ore more "G"s at the line before ENDTEST.
307   
308   STARTTEST
309   :so small.vim
310   :se nocp nomore viminfo+=nviminfo
311   :so test49.vim
312 ! GGGGGGGGGG"rp:.-,$wq! test.out
313   ENDTEST
314   
315   Results of test49.vim:
316 --- 1,29 ----
317   This is a test of the script language.
318   
319   If after adding a new test, the test output doesn't appear properly in
320 ! test49.failed, try to add one ore more "G"s at the line ending in "test.out"
321   
322   STARTTEST
323   :so small.vim
324   :se nocp nomore viminfo+=nviminfo
325   :so test49.vim
326 ! GGGGGGGGGGGGGG"rp:.-,$w! test.out
327 ! :"
328 ! :" make valgrind happy
329 ! :redir => funclist
330 ! :silent func
331 ! :redir END
332 ! :for line in split(funclist, "\n")
333 ! :  let name = matchstr(line, 'function \zs[A-Z]\w*\ze(')
334 ! :  if name != ''
335 ! :    exe "delfunc " . name
336 ! :  endif
337 ! :endfor
338 ! :for v in keys(g:)
339 ! :  silent! exe "unlet " . v
340 ! :endfor
341 ! :unlet v
342 ! :qa!
343   ENDTEST
344   
345   Results of test49.vim:
346 *** ../vim-7.1.119/src/testdir/test55.in        Sat May  5 20:03:56 2007
347 --- src/testdir/test55.in       Mon Sep 17 19:53:48 2007
348 ***************
349 *** 345,350 ****
350 --- 345,354 ----
351   :endfun
352   :call Test(1, 2, [3, 4], {5: 6})  " This may take a while
353   :"
354 + :delfunc Test
355 + :unlet dict
356 + :call garbagecollect(1)
357 + :"
358   :/^start:/,$wq! test.out
359   ENDTEST
360   
361 *** ../vim-7.1.119/src/testdir/test56.in        Tue Sep  5 13:36:02 2006
362 --- src/testdir/test56.in       Sun Sep 16 17:54:20 2007
363 ***************
364 *** 17,21 ****
365   fun s:DoNothing()
366     call append(line('$'), "nothing line")
367   endfun
368 ! nnoremap <buffer> _x  :call <SID>DoNothing()<bar>call <SID>DoLast()<cr>
369   end:
370 --- 17,21 ----
371   fun s:DoNothing()
372     call append(line('$'), "nothing line")
373   endfun
374 ! nnoremap <buffer> _x  :call <SID>DoNothing()<bar>call <SID>DoLast()<bar>delfunc <SID>DoNothing<bar>delfunc <SID>DoLast<cr>
375   end:
376 *** ../vim-7.1.119/src/testdir/test58.in        Wed Apr  5 22:38:56 2006
377 --- src/testdir/test58.in       Sun Sep 16 18:17:03 2007
378 ***************
379 *** 86,91 ****
380 --- 86,92 ----
381   :$put =str
382   `m]s:let [str, a] = spellbadword()
383   :$put =str
384 + :unlet str a
385   :"
386   :" Postponed prefixes
387   :call TestOne('2', '1')
388 ***************
389 *** 99,104 ****
390 --- 100,109 ----
391   :"
392   :" NOSLITSUGS
393   :call TestOne('8', '8')
394 + :"
395 + :" clean up for valgrind
396 + :delfunc TestOne
397 + :set spl= enc=latin1
398   :"
399   gg:/^test output:/,$wq! test.out
400   ENDTEST
401 *** ../vim-7.1.119/src/testdir/test59.in        Wed Apr  5 22:27:11 2006
402 --- src/testdir/test59.in       Sun Sep 16 18:17:23 2007
403 ***************
404 *** 90,95 ****
405 --- 90,96 ----
406   :$put =str
407   `m]s:let [str, a] = spellbadword()
408   :$put =str
409 + :unlet str a
410   :"
411   :" Postponed prefixes
412   :call TestOne('2', '1')
413 ***************
414 *** 100,105 ****
415 --- 101,110 ----
416   :call TestOne('5', '5')
417   :call TestOne('6', '6')
418   :call TestOne('7', '7')
419 + :"
420 + :" clean up for valgrind
421 + :delfunc TestOne
422 + :set spl= enc=latin1
423   :"
424   gg:/^test output:/,$wq! test.out
425   ENDTEST
426 *** ../vim-7.1.119/src/testdir/test60.in        Fri May  5 23:11:11 2006
427 --- src/testdir/test60.in       Mon Sep 17 19:58:43 2007
428 ***************
429 *** 569,574 ****
430 --- 569,577 ----
431       redir END
432   endfunction
433   :call TestExists()
434 + :delfunc TestExists
435 + :delfunc RunTest
436 + :delfunc TestFuncArg
437   :edit! test.out
438   :set ff=unix
439   :w
440 *** ../vim-7.1.119/src/testdir/test60.vim       Fri Jan 13 00:14:55 2006
441 --- src/testdir/test60.vim      Mon Sep 17 19:56:02 2007
442 ***************
443 *** 94,97 ****
444 --- 94,98 ----
445   else
446       echo "FAILED"
447   endif
448 + unlet str
449   
450 *** ../vim-7.1.119/src/testdir/test62.in        Sun Apr 30 20:28:14 2006
451 --- src/testdir/test62.in       Sun Sep 16 17:24:04 2007
452 ***************
453 *** 7,12 ****
454 --- 7,13 ----
455   :let nr = tabpagenr()
456   :q
457   :call append(line('$'), 'tab page ' . nr)
458 + :unlet nr
459   :"
460   :" Open three tab pages and use ":tabdo"
461   :0tabnew
462 ***************
463 *** 23,28 ****
464 --- 24,30 ----
465   :q!
466   :call append(line('$'), line1)
467   :call append(line('$'), line2)
468 + :unlet line1 line2
469   :"
470   :"
471   :/^Results/,$w! test.out
472 *** ../vim-7.1.119/src/testdir/test63.in        Thu Jul 26 22:55:11 2007
473 --- src/testdir/test63.in       Sun Sep 16 17:11:07 2007
474 ***************
475 *** 60,66 ****
476   :else
477   :  let @r .= "FAILED\n"
478   :endif
479 ! :" --- Check that "matchdelete()" returns 0 if succesfull and otherwise -1.
480   :let @r .= "*** Test 6: "
481   :let m = matchadd("MyGroup1", "TODO")
482   :let r1 = matchdelete(m)
483 --- 60,66 ----
484   :else
485   :  let @r .= "FAILED\n"
486   :endif
487 ! :" --- Check that "matchdelete()" returns 0 if successful and otherwise -1.
488   :let @r .= "*** Test 6: "
489   :let m = matchadd("MyGroup1", "TODO")
490   :let r1 = matchdelete(m)
491 ***************
492 *** 117,123 ****
493   :" --- Check that "setmatches()" will not add two matches with the same ID. The
494   :" --- expected behaviour (for now) is to add the first match but not the
495   :" --- second and to return 0 (even though it is a matter of debate whether
496 ! :" --- this can be considered succesfull behaviour).
497   :let @r .= "*** Test 9: "
498   :let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}])
499   :if getmatches() == [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}] && r1 == 0
500 --- 117,123 ----
501   :" --- Check that "setmatches()" will not add two matches with the same ID. The
502   :" --- expected behaviour (for now) is to add the first match but not the
503   :" --- second and to return 0 (even though it is a matter of debate whether
504 ! :" --- this can be considered successful behaviour).
505   :let @r .= "*** Test 9: "
506   :let r1 = setmatches([{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}, {'group': 'MyGroup2', 'pattern': 'FIXME', 'priority': 10, 'id': 1}])
507   :if getmatches() == [{'group': 'MyGroup1', 'pattern': 'TODO', 'priority': 10, 'id': 1}] && r1 == 0
508 ***************
509 *** 127,133 ****
510   :endif
511   :call clearmatches()
512   :unlet r1
513 ! :" --- Check that "setmatches()" returns 0 if succesfull and otherwise -1.
514   :" --- (A range of valid and invalid input values are tried out to generate the
515   :" --- return values.)
516   :let @r .= "*** Test 10: "
517 --- 127,133 ----
518   :endif
519   :call clearmatches()
520   :unlet r1
521 ! :" --- Check that "setmatches()" returns 0 if successful and otherwise -1.
522   :" --- (A range of valid and invalid input values are tried out to generate the
523   :" --- return values.)
524   :let @r .= "*** Test 10: "
525 *** ../vim-7.1.119/src/testdir/test64.in        Tue Aug 14 17:28:14 2007
526 --- src/testdir/test64.in       Sun Sep 16 17:43:03 2007
527 ***************
528 *** 44,51 ****
529 --- 44,53 ----
530   :        $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"'
531   :      endif
532   :    endfor
533 + :    unlet i
534   :  endif
535   :endfor
536 + :unlet t tl e l
537   :/^Results/,$wq! test.out
538   ENDTEST
539   
540 *** ../vim-7.1.119/src/version.c        Tue Sep 25 14:50:19 2007
541 --- src/version.c       Tue Sep 25 17:36:22 2007
542 ***************
543 *** 668,669 ****
544 --- 668,671 ----
545   {   /* Add new patch number below this line */
546 + /**/
547 +     120,
548   /**/
549
550 -- 
551 BEDEVERE: How do you know so much about swallows?
552 ARTHUR:   Well you have to know these things when you're a king, you know.
553                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
554
555  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
556 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
557 \\\        download, build and distribute -- http://www.A-A-P.org        ///
558  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.084568 seconds and 3 git commands to generate.