]> git.pld-linux.org Git - packages/vim.git/blob - 7.3.056
- new
[packages/vim.git] / 7.3.056
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.056
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.3.056
11 Problem:    "getline" argument in do_cmdline() shadows global.
12 Solution:   Rename the argument.
13 Files:      src/ex_docmd.c
14
15
16 *** ../vim-7.3.055/src/ex_docmd.c       2010-11-10 18:59:50.000000000 +0100
17 --- src/ex_docmd.c      2010-11-16 11:24:40.000000000 +0100
18 ***************
19 *** 733,739 ****
20    * do_cmdline(): execute one Ex command line
21    *
22    * 1. Execute "cmdline" when it is not NULL.
23 !  *    If "cmdline" is NULL, or more lines are needed, getline() is used.
24    * 2. Split up in parts separated with '|'.
25    *
26    * This function can be called recursively!
27 --- 733,739 ----
28    * do_cmdline(): execute one Ex command line
29    *
30    * 1. Execute "cmdline" when it is not NULL.
31 !  *    If "cmdline" is NULL, or more lines are needed, fgetline() is used.
32    * 2. Split up in parts separated with '|'.
33    *
34    * This function can be called recursively!
35 ***************
36 *** 741,747 ****
37    * flags:
38    * DOCMD_VERBOSE  - The command will be included in the error message.
39    * DOCMD_NOWAIT   - Don't call wait_return() and friends.
40 !  * DOCMD_REPEAT   - Repeat execution until getline() returns NULL.
41    * DOCMD_KEYTYPED - Don't reset KeyTyped.
42    * DOCMD_EXCRESET - Reset the exception environment (used for debugging).
43    * DOCMD_KEEPLINE - Store first typed line (for repeating with ".").
44 --- 741,747 ----
45    * flags:
46    * DOCMD_VERBOSE  - The command will be included in the error message.
47    * DOCMD_NOWAIT   - Don't call wait_return() and friends.
48 !  * DOCMD_REPEAT   - Repeat execution until fgetline() returns NULL.
49    * DOCMD_KEYTYPED - Don't reset KeyTyped.
50    * DOCMD_EXCRESET - Reset the exception environment (used for debugging).
51    * DOCMD_KEEPLINE - Store first typed line (for repeating with ".").
52 ***************
53 *** 749,763 ****
54    * return FAIL if cmdline could not be executed, OK otherwise
55    */
56       int
57 ! do_cmdline(cmdline, getline, cookie, flags)
58       char_u    *cmdline;
59 !     char_u    *(*getline) __ARGS((int, void *, int));
60 !     void      *cookie;                /* argument for getline() */
61       int               flags;
62   {
63       char_u    *next_cmdline;          /* next cmd to execute */
64       char_u    *cmdline_copy = NULL;   /* copy of cmd line */
65 !     int               used_getline = FALSE;   /* used "getline" to obtain command */
66       static int        recursive = 0;          /* recursive depth */
67       int               msg_didout_before_start = 0;
68       int               count = 0;              /* line number count */
69 --- 749,763 ----
70    * return FAIL if cmdline could not be executed, OK otherwise
71    */
72       int
73 ! do_cmdline(cmdline, fgetline, cookie, flags)
74       char_u    *cmdline;
75 !     char_u    *(*fgetline) __ARGS((int, void *, int));
76 !     void      *cookie;                /* argument for fgetline() */
77       int               flags;
78   {
79       char_u    *next_cmdline;          /* next cmd to execute */
80       char_u    *cmdline_copy = NULL;   /* copy of cmd line */
81 !     int               used_getline = FALSE;   /* used "fgetline" to obtain command */
82       static int        recursive = 0;          /* recursive depth */
83       int               msg_didout_before_start = 0;
84       int               count = 0;              /* line number count */
85 ***************
86 *** 775,788 ****
87       struct msglist    **saved_msg_list = NULL;
88       struct msglist    *private_msg_list;
89   
90 !     /* "getline" and "cookie" passed to do_one_cmd() */
91       char_u    *(*cmd_getline) __ARGS((int, void *, int));
92       void      *cmd_cookie;
93       struct loop_cookie cmd_loop_cookie;
94       void      *real_cookie;
95       int               getline_is_func;
96   #else
97 ! # define cmd_getline getline
98   # define cmd_cookie cookie
99   #endif
100       static int        call_depth = 0;         /* recursiveness */
101 --- 775,788 ----
102       struct msglist    **saved_msg_list = NULL;
103       struct msglist    *private_msg_list;
104   
105 !     /* "fgetline" and "cookie" passed to do_one_cmd() */
106       char_u    *(*cmd_getline) __ARGS((int, void *, int));
107       void      *cmd_cookie;
108       struct loop_cookie cmd_loop_cookie;
109       void      *real_cookie;
110       int               getline_is_func;
111   #else
112 ! # define cmd_getline fgetline
113   # define cmd_cookie cookie
114   #endif
115       static int        call_depth = 0;         /* recursiveness */
116 ***************
117 *** 822,831 ****
118       cstack.cs_lflags = 0;
119       ga_init2(&lines_ga, (int)sizeof(wcmd_T), 10);
120   
121 !     real_cookie = getline_cookie(getline, cookie);
122   
123       /* Inside a function use a higher nesting level. */
124 !     getline_is_func = getline_equal(getline, cookie, get_func_line);
125       if (getline_is_func && ex_nesting_level == func_level(real_cookie))
126         ++ex_nesting_level;
127   
128 --- 822,831 ----
129       cstack.cs_lflags = 0;
130       ga_init2(&lines_ga, (int)sizeof(wcmd_T), 10);
131   
132 !     real_cookie = getline_cookie(fgetline, cookie);
133   
134       /* Inside a function use a higher nesting level. */
135 !     getline_is_func = getline_equal(fgetline, cookie, get_func_line);
136       if (getline_is_func && ex_nesting_level == func_level(real_cookie))
137         ++ex_nesting_level;
138   
139 ***************
140 *** 837,843 ****
141         breakpoint = func_breakpoint(real_cookie);
142         dbg_tick = func_dbg_tick(real_cookie);
143       }
144 !     else if (getline_equal(getline, cookie, getsourceline))
145       {
146         fname = sourcing_name;
147         breakpoint = source_breakpoint(real_cookie);
148 --- 837,843 ----
149         breakpoint = func_breakpoint(real_cookie);
150         dbg_tick = func_dbg_tick(real_cookie);
151       }
152 !     else if (getline_equal(fgetline, cookie, getsourceline))
153       {
154         fname = sourcing_name;
155         breakpoint = source_breakpoint(real_cookie);
156 ***************
157 *** 881,887 ****
158        * KeyTyped is only set when calling vgetc().  Reset it here when not
159        * calling vgetc() (sourced command lines).
160        */
161 !     if (!(flags & DOCMD_KEYTYPED) && !getline_equal(getline, cookie, getexline))
162         KeyTyped = FALSE;
163   
164       /*
165 --- 881,888 ----
166        * KeyTyped is only set when calling vgetc().  Reset it here when not
167        * calling vgetc() (sourced command lines).
168        */
169 !     if (!(flags & DOCMD_KEYTYPED)
170 !                              && !getline_equal(fgetline, cookie, getexline))
171         KeyTyped = FALSE;
172   
173       /*
174 ***************
175 *** 894,900 ****
176       do
177       {
178   #ifdef FEAT_EVAL
179 !       getline_is_func = getline_equal(getline, cookie, get_func_line);
180   #endif
181   
182         /* stop skipping cmds for an error msg after all endif/while/for */
183 --- 895,901 ----
184       do
185       {
186   #ifdef FEAT_EVAL
187 !       getline_is_func = getline_equal(fgetline, cookie, get_func_line);
188   #endif
189   
190         /* stop skipping cmds for an error msg after all endif/while/for */
191 ***************
192 *** 909,915 ****
193   
194         /*
195          * 1. If repeating a line in a loop, get a line from lines_ga.
196 !        * 2. If no line given: Get an allocated line with getline().
197          * 3. If a line is given: Make a copy, so we can mess with it.
198          */
199   
200 --- 910,916 ----
201   
202         /*
203          * 1. If repeating a line in a loop, get a line from lines_ga.
204 !        * 2. If no line given: Get an allocated line with fgetline().
205          * 3. If a line is given: Make a copy, so we can mess with it.
206          */
207   
208 ***************
209 *** 938,949 ****
210             }
211   #ifdef FEAT_PROFILE
212             else if (do_profiling == PROF_YES
213 !                            && getline_equal(getline, cookie, getsourceline))
214                 script_line_end();
215   #endif
216   
217             /* Check if a sourced file hit a ":finish" command. */
218 !           if (source_finished(getline, cookie))
219             {
220                 retval = FAIL;
221                 break;
222 --- 939,950 ----
223             }
224   #ifdef FEAT_PROFILE
225             else if (do_profiling == PROF_YES
226 !                           && getline_equal(fgetline, cookie, getsourceline))
227                 script_line_end();
228   #endif
229   
230             /* Check if a sourced file hit a ":finish" command. */
231 !           if (source_finished(fgetline, cookie))
232             {
233                 retval = FAIL;
234                 break;
235 ***************
236 *** 954,960 ****
237                                                    && *dbg_tick != debug_tick)
238             {
239                 *breakpoint = dbg_find_breakpoint(
240 !                               getline_equal(getline, cookie, getsourceline),
241                                                         fname, sourcing_lnum);
242                 *dbg_tick = debug_tick;
243             }
244 --- 955,961 ----
245                                                    && *dbg_tick != debug_tick)
246             {
247                 *breakpoint = dbg_find_breakpoint(
248 !                               getline_equal(fgetline, cookie, getsourceline),
249                                                         fname, sourcing_lnum);
250                 *dbg_tick = debug_tick;
251             }
252 ***************
253 *** 969,975 ****
254                 dbg_breakpoint(fname, sourcing_lnum);
255                 /* Find next breakpoint. */
256                 *breakpoint = dbg_find_breakpoint(
257 !                               getline_equal(getline, cookie, getsourceline),
258                                                         fname, sourcing_lnum);
259                 *dbg_tick = debug_tick;
260             }
261 --- 970,976 ----
262                 dbg_breakpoint(fname, sourcing_lnum);
263                 /* Find next breakpoint. */
264                 *breakpoint = dbg_find_breakpoint(
265 !                              getline_equal(fgetline, cookie, getsourceline),
266                                                         fname, sourcing_lnum);
267                 *dbg_tick = debug_tick;
268             }
269 ***************
270 *** 978,984 ****
271             {
272                 if (getline_is_func)
273                     func_line_start(real_cookie);
274 !               else if (getline_equal(getline, cookie, getsourceline))
275                     script_line_start();
276             }
277   # endif
278 --- 979,985 ----
279             {
280                 if (getline_is_func)
281                     func_line_start(real_cookie);
282 !               else if (getline_equal(fgetline, cookie, getsourceline))
283                     script_line_start();
284             }
285   # endif
286 ***************
287 *** 987,993 ****
288         if (cstack.cs_looplevel > 0)
289         {
290             /* Inside a while/for loop we need to store the lines and use them
291 !            * again.  Pass a different "getline" function to do_one_cmd()
292              * below, so that it stores lines in or reads them from
293              * "lines_ga".  Makes it possible to define a function inside a
294              * while/for loop. */
295 --- 988,994 ----
296         if (cstack.cs_looplevel > 0)
297         {
298             /* Inside a while/for loop we need to store the lines and use them
299 !            * again.  Pass a different "fgetline" function to do_one_cmd()
300              * below, so that it stores lines in or reads them from
301              * "lines_ga".  Makes it possible to define a function inside a
302              * while/for loop. */
303 ***************
304 *** 995,1021 ****
305             cmd_cookie = (void *)&cmd_loop_cookie;
306             cmd_loop_cookie.lines_gap = &lines_ga;
307             cmd_loop_cookie.current_line = current_line;
308 !           cmd_loop_cookie.getline = getline;
309             cmd_loop_cookie.cookie = cookie;
310             cmd_loop_cookie.repeating = (current_line < lines_ga.ga_len);
311         }
312         else
313         {
314 !           cmd_getline = getline;
315             cmd_cookie = cookie;
316         }
317   #endif
318   
319 !       /* 2. If no line given, get an allocated line with getline(). */
320         if (next_cmdline == NULL)
321         {
322             /*
323              * Need to set msg_didout for the first line after an ":if",
324              * otherwise the ":if" will be overwritten.
325              */
326 !           if (count == 1 && getline_equal(getline, cookie, getexline))
327                 msg_didout = TRUE;
328 !           if (getline == NULL || (next_cmdline = getline(':', cookie,
329   #ifdef FEAT_EVAL
330                     cstack.cs_idx < 0 ? 0 : (cstack.cs_idx + 1) * 2
331   #else
332 --- 996,1022 ----
333             cmd_cookie = (void *)&cmd_loop_cookie;
334             cmd_loop_cookie.lines_gap = &lines_ga;
335             cmd_loop_cookie.current_line = current_line;
336 !           cmd_loop_cookie.getline = fgetline;
337             cmd_loop_cookie.cookie = cookie;
338             cmd_loop_cookie.repeating = (current_line < lines_ga.ga_len);
339         }
340         else
341         {
342 !           cmd_getline = fgetline;
343             cmd_cookie = cookie;
344         }
345   #endif
346   
347 !       /* 2. If no line given, get an allocated line with fgetline(). */
348         if (next_cmdline == NULL)
349         {
350             /*
351              * Need to set msg_didout for the first line after an ":if",
352              * otherwise the ":if" will be overwritten.
353              */
354 !           if (count == 1 && getline_equal(fgetline, cookie, getexline))
355                 msg_didout = TRUE;
356 !           if (fgetline == NULL || (next_cmdline = fgetline(':', cookie,
357   #ifdef FEAT_EVAL
358                     cstack.cs_idx < 0 ? 0 : (cstack.cs_idx + 1) * 2
359   #else
360 ***************
361 *** 1142,1148 ****
362              * If the command was typed, remember it for the ':' register.
363              * Do this AFTER executing the command to make :@: work.
364              */
365 !           if (getline_equal(getline, cookie, getexline)
366                                                   && new_last_cmdline != NULL)
367             {
368                 vim_free(last_cmdline);
369 --- 1143,1149 ----
370              * If the command was typed, remember it for the ':' register.
371              * Do this AFTER executing the command to make :@: work.
372              */
373 !           if (getline_equal(fgetline, cookie, getexline)
374                                                   && new_last_cmdline != NULL)
375             {
376                 vim_free(last_cmdline);
377 ***************
378 *** 1163,1169 ****
379   #ifdef FEAT_EVAL
380         /* reset did_emsg for a function that is not aborted by an error */
381         if (did_emsg && !force_abort
382 !               && getline_equal(getline, cookie, get_func_line)
383                                               && !func_has_abort(real_cookie))
384             did_emsg = FALSE;
385   
386 --- 1164,1170 ----
387   #ifdef FEAT_EVAL
388         /* reset did_emsg for a function that is not aborted by an error */
389         if (did_emsg && !force_abort
390 !               && getline_equal(fgetline, cookie, get_func_line)
391                                               && !func_has_abort(real_cookie))
392             did_emsg = FALSE;
393   
394 ***************
395 *** 1202,1208 ****
396                     if (breakpoint != NULL)
397                     {
398                         *breakpoint = dbg_find_breakpoint(
399 !                               getline_equal(getline, cookie, getsourceline),
400                                                                         fname,
401                            ((wcmd_T *)lines_ga.ga_data)[current_line].lnum-1);
402                         *dbg_tick = debug_tick;
403 --- 1203,1209 ----
404                     if (breakpoint != NULL)
405                     {
406                         *breakpoint = dbg_find_breakpoint(
407 !                              getline_equal(fgetline, cookie, getsourceline),
408                                                                         fname,
409                            ((wcmd_T *)lines_ga.ga_data)[current_line].lnum-1);
410                         *dbg_tick = debug_tick;
411 ***************
412 *** 1296,1303 ****
413   #endif
414             )
415             && !(did_emsg && used_getline
416 !                         && (getline_equal(getline, cookie, getexmodeline)
417 !                               || getline_equal(getline, cookie, getexline)))
418             && (next_cmdline != NULL
419   #ifdef FEAT_EVAL
420                         || cstack.cs_idx >= 0
421 --- 1297,1304 ----
422   #endif
423             )
424             && !(did_emsg && used_getline
425 !                           && (getline_equal(fgetline, cookie, getexmodeline)
426 !                              || getline_equal(fgetline, cookie, getexline)))
427             && (next_cmdline != NULL
428   #ifdef FEAT_EVAL
429                         || cstack.cs_idx >= 0
430 ***************
431 *** 1316,1324 ****
432          * unclosed conditional.
433          */
434         if (!got_int && !did_throw
435 !               && ((getline_equal(getline, cookie, getsourceline)
436 !                       && !source_finished(getline, cookie))
437 !                   || (getline_equal(getline, cookie, get_func_line)
438                                             && !func_has_ended(real_cookie))))
439         {
440             if (cstack.cs_flags[cstack.cs_idx] & CSF_TRY)
441 --- 1317,1325 ----
442          * unclosed conditional.
443          */
444         if (!got_int && !did_throw
445 !               && ((getline_equal(fgetline, cookie, getsourceline)
446 !                       && !source_finished(fgetline, cookie))
447 !                   || (getline_equal(fgetline, cookie, get_func_line)
448                                             && !func_has_ended(real_cookie))))
449         {
450             if (cstack.cs_flags[cstack.cs_idx] & CSF_TRY)
451 ***************
452 *** 1354,1360 ****
453       /* If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
454        * lack was reported above and the error message is to be converted to an
455        * exception, do this now after rewinding the cstack. */
456 !     do_errthrow(&cstack, getline_equal(getline, cookie, get_func_line)
457                                   ? (char_u *)"endfunction" : (char_u *)NULL);
458   
459       if (trylevel == 0)
460 --- 1355,1361 ----
461       /* If a missing ":endtry", ":endwhile", ":endfor", or ":endif" or a memory
462        * lack was reported above and the error message is to be converted to an
463        * exception, do this now after rewinding the cstack. */
464 !     do_errthrow(&cstack, getline_equal(fgetline, cookie, get_func_line)
465                                   ? (char_u *)"endfunction" : (char_u *)NULL);
466   
467       if (trylevel == 0)
468 ***************
469 *** 1449,1457 ****
470        */
471       if (did_throw)
472         need_rethrow = TRUE;
473 !     if ((getline_equal(getline, cookie, getsourceline)
474                 && ex_nesting_level > source_level(real_cookie))
475 !           || (getline_equal(getline, cookie, get_func_line)
476                 && ex_nesting_level > func_level(real_cookie) + 1))
477       {
478         if (!did_throw)
479 --- 1450,1458 ----
480        */
481       if (did_throw)
482         need_rethrow = TRUE;
483 !     if ((getline_equal(fgetline, cookie, getsourceline)
484                 && ex_nesting_level > source_level(real_cookie))
485 !           || (getline_equal(fgetline, cookie, get_func_line)
486                 && ex_nesting_level > func_level(real_cookie) + 1))
487       {
488         if (!did_throw)
489 ***************
490 *** 1460,1475 ****
491       else
492       {
493         /* When leaving a function, reduce nesting level. */
494 !       if (getline_equal(getline, cookie, get_func_line))
495             --ex_nesting_level;
496         /*
497          * Go to debug mode when returning from a function in which we are
498          * single-stepping.
499          */
500 !       if ((getline_equal(getline, cookie, getsourceline)
501 !                   || getline_equal(getline, cookie, get_func_line))
502                 && ex_nesting_level + 1 <= debug_break_level)
503 !           do_debug(getline_equal(getline, cookie, getsourceline)
504                     ? (char_u *)_("End of sourced file")
505                     : (char_u *)_("End of function"));
506       }
507 --- 1461,1476 ----
508       else
509       {
510         /* When leaving a function, reduce nesting level. */
511 !       if (getline_equal(fgetline, cookie, get_func_line))
512             --ex_nesting_level;
513         /*
514          * Go to debug mode when returning from a function in which we are
515          * single-stepping.
516          */
517 !       if ((getline_equal(fgetline, cookie, getsourceline)
518 !                   || getline_equal(fgetline, cookie, get_func_line))
519                 && ex_nesting_level + 1 <= debug_break_level)
520 !           do_debug(getline_equal(fgetline, cookie, getsourceline)
521                     ? (char_u *)_("End of sourced file")
522                     : (char_u *)_("End of function"));
523       }
524 *** ../vim-7.3.055/src/version.c        2010-11-16 11:28:33.000000000 +0100
525 --- src/version.c       2010-11-16 11:27:09.000000000 +0100
526 ***************
527 *** 716,717 ****
528 --- 716,719 ----
529   {   /* Add new patch number below this line */
530 + /**/
531 +     56,
532   /**/
533
534 -- 
535 Lawmakers made it obligatory for everybody to take at least one bath
536 each week -- on Saturday night.
537                 [real standing law in Vermont, United States of America]
538
539  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
540 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
541 \\\  an exciting new programming language -- http://www.Zimbu.org        ///
542  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.070085 seconds and 3 git commands to generate.