home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.1 / 7.1.256 < prev    next >
Encoding:
Internet Message Format  |  2008-02-19  |  49.7 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.1.256
  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.256
  11. Problem:    findfile() also returns directories.
  12. Solution:   Cleanup the code for finding files and directories in a list of
  13.             directories.  Remove the ugly global ff_search_ctx.
  14. Files:      src/eval.c, src/misc2.c, src/vim.h, src/tag.c
  15.  
  16.  
  17. *** ../vim-7.1.255/src/eval.c    Wed Feb 13 12:41:30 2008
  18. --- src/eval.c    Wed Feb 20 11:08:21 2008
  19. ***************
  20. *** 9203,9215 ****
  21.       rettv->vval.v_number = filewritable(get_tv_string(&argvars[0]));
  22.   }
  23.   
  24. ! static void findfilendir __ARGS((typval_T *argvars, typval_T *rettv, int dir));
  25.   
  26.       static void
  27. ! findfilendir(argvars, rettv, dir)
  28.       typval_T    *argvars;
  29.       typval_T    *rettv;
  30. !     int        dir;
  31.   {
  32.   #ifdef FEAT_SEARCHPATH
  33.       char_u    *fname;
  34. --- 9205,9217 ----
  35.       rettv->vval.v_number = filewritable(get_tv_string(&argvars[0]));
  36.   }
  37.   
  38. ! static void findfilendir __ARGS((typval_T *argvars, typval_T *rettv, int find_what));
  39.   
  40.       static void
  41. ! findfilendir(argvars, rettv, find_what)
  42.       typval_T    *argvars;
  43.       typval_T    *rettv;
  44. !     int        find_what;
  45.   {
  46.   #ifdef FEAT_SEARCHPATH
  47.       char_u    *fname;
  48. ***************
  49. *** 9254,9261 ****
  50.           vim_free(fresult);
  51.           fresult = find_file_in_path_option(first ? fname : NULL,
  52.                              first ? (int)STRLEN(fname) : 0,
  53. !                     0, first, path, dir, curbuf->b_ffname,
  54. !                     dir ? (char_u *)"" : curbuf->b_p_sua);
  55.           first = FALSE;
  56.   
  57.           if (fresult != NULL && rettv->v_type == VAR_LIST)
  58. --- 9256,9266 ----
  59.           vim_free(fresult);
  60.           fresult = find_file_in_path_option(first ? fname : NULL,
  61.                              first ? (int)STRLEN(fname) : 0,
  62. !                     0, first, path,
  63. !                     find_what,
  64. !                     curbuf->b_ffname,
  65. !                     find_what == FINDFILE_DIR
  66. !                         ? (char_u *)"" : curbuf->b_p_sua);
  67.           first = FALSE;
  68.   
  69.           if (fresult != NULL && rettv->v_type == VAR_LIST)
  70. ***************
  71. *** 9445,9451 ****
  72.       typval_T    *argvars;
  73.       typval_T    *rettv;
  74.   {
  75. !     findfilendir(argvars, rettv, TRUE);
  76.   }
  77.   
  78.   /*
  79. --- 9450,9456 ----
  80.       typval_T    *argvars;
  81.       typval_T    *rettv;
  82.   {
  83. !     findfilendir(argvars, rettv, FINDFILE_DIR);
  84.   }
  85.   
  86.   /*
  87. ***************
  88. *** 9456,9462 ****
  89.       typval_T    *argvars;
  90.       typval_T    *rettv;
  91.   {
  92. !     findfilendir(argvars, rettv, FALSE);
  93.   }
  94.   
  95.   /*
  96. --- 9461,9467 ----
  97.       typval_T    *argvars;
  98.       typval_T    *rettv;
  99.   {
  100. !     findfilendir(argvars, rettv, FINDFILE_FILE);
  101.   }
  102.   
  103.   /*
  104. *** ../vim-7.1.255/src/misc2.c    Fri Jan  4 21:25:01 2008
  105. --- src/misc2.c    Wed Feb 13 17:19:21 2008
  106. ***************
  107. *** 3777,3785 ****
  108.       char_u        ffs_filearray_cur;   /* needed for partly handled dirs */
  109.   
  110.       /* to store status of partly handled directories
  111. !      * 0: we work the on this directory for the first time
  112.        * 1: this directory was partly searched in an earlier step
  113. !     */
  114.       int            ffs_stage;
  115.   
  116.       /* How deep are we in the directory tree?
  117. --- 3778,3786 ----
  118.       char_u        ffs_filearray_cur;   /* needed for partly handled dirs */
  119.   
  120.       /* to store status of partly handled directories
  121. !      * 0: we work on this directory for the first time
  122.        * 1: this directory was partly searched in an earlier step
  123. !      */
  124.       int            ffs_stage;
  125.   
  126.       /* How deep are we in the directory tree?
  127. ***************
  128. *** 3848,3853 ****
  129. --- 3849,3855 ----
  130.    * Set the default maximum depth.
  131.    */
  132.   #define FF_MAX_STAR_STAR_EXPAND ((char_u)30)
  133.   /*
  134.    * The search context:
  135.    *   ffsc_stack_ptr:    the stack for the dirs to search
  136. ***************
  137. *** 3862,3868 ****
  138.    *   ffsc_wc_path:    the part of the given path containing wildcards
  139.    *   ffsc_level:    how many levels of dirs to search downwards
  140.    *   ffsc_stopdirs_v:    array of stop directories for upward search
  141. !  *   ffsc_need_dir:    TRUE if we search for a directory
  142.    */
  143.   typedef struct ff_search_ctx_T
  144.   {
  145. --- 3864,3870 ----
  146.    *   ffsc_wc_path:    the part of the given path containing wildcards
  147.    *   ffsc_level:    how many levels of dirs to search downwards
  148.    *   ffsc_stopdirs_v:    array of stop directories for upward search
  149. !  *   ffsc_find_what:    FINDFILE_BOTH, FINDFILE_DIR or FINDFILE_FILE
  150.    */
  151.   typedef struct ff_search_ctx_T
  152.   {
  153. ***************
  154. *** 3879,3889 ****
  155.        int            ffsc_level;
  156.        char_u            **ffsc_stopdirs_v;
  157.   #endif
  158. !      int            ffsc_need_dir;
  159.   } ff_search_ctx_T;
  160.   
  161. - static ff_search_ctx_T *ff_search_ctx = NULL;
  162.   /* locally needed functions */
  163.   #ifdef FEAT_PATH_EXTRA
  164.   static int ff_check_visited __ARGS((ff_visited_T **, char_u *, char_u *));
  165. --- 3881,3889 ----
  166.        int            ffsc_level;
  167.        char_u            **ffsc_stopdirs_v;
  168.   #endif
  169. !      int            ffsc_find_what;
  170.   } ff_search_ctx_T;
  171.   
  172.   /* locally needed functions */
  173.   #ifdef FEAT_PATH_EXTRA
  174.   static int ff_check_visited __ARGS((ff_visited_T **, char_u *, char_u *));
  175. ***************
  176. *** 3897,3906 ****
  177.   static int ff_wc_equal __ARGS((char_u *s1, char_u *s2));
  178.   #endif
  179.   
  180. ! static void ff_push __ARGS((ff_stack_T *));
  181. ! static ff_stack_T * ff_pop __ARGS((void));
  182. ! static void ff_clear __ARGS((void));
  183. ! static void ff_free_stack_element __ARGS((ff_stack_T *));
  184.   #ifdef FEAT_PATH_EXTRA
  185.   static ff_stack_T *ff_create_stack_element __ARGS((char_u *, char_u *, int, int));
  186.   #else
  187. --- 3897,3906 ----
  188.   static int ff_wc_equal __ARGS((char_u *s1, char_u *s2));
  189.   #endif
  190.   
  191. ! static void ff_push __ARGS((ff_search_ctx_T *search_ctx, ff_stack_T *stack_ptr));
  192. ! static ff_stack_T *ff_pop __ARGS((ff_search_ctx_T *search_ctx));
  193. ! static void ff_clear __ARGS((ff_search_ctx_T *search_ctx));
  194. ! static void ff_free_stack_element __ARGS((ff_stack_T *stack_ptr));
  195.   #ifdef FEAT_PATH_EXTRA
  196.   static ff_stack_T *ff_create_stack_element __ARGS((char_u *, char_u *, int, int));
  197.   #else
  198. ***************
  199. *** 3961,3966 ****
  200. --- 3961,3969 ----
  201.    * not related to restricts given to the '**' wildcard. If 'level' is 100
  202.    * and you use '**200' vim_findfile() will stop after 100 levels.
  203.    *
  204. +  * 'filename' cannot contain wildcards!  It is used as-is, no backslashes to
  205. +  * escape special characters.
  206. +  *
  207.    * If 'stopdirs' is not NULL and nothing is found downward, the search is
  208.    * restarted on the next higher directory level. This is repeated until the
  209.    * start-directory of a search is contained in 'stopdirs'. 'stopdirs' has the
  210. ***************
  211. *** 3980,4053 ****
  212.    * The list of visited files/dirs can also be cleared with the function
  213.    * vim_findfile_free_visited().
  214.    *
  215. !  * Set the parameter 'need_dir' to TRUE if you want to search for a directory
  216. !  * instead of a file.
  217.    *
  218.    * A search context returned by a previous call to vim_findfile_init() can be
  219. !  * passed in the parameter 'search_ctx'. This context is than reused and
  220. !  * reinitialized with the new parameters. The list of already viseted
  221.    * directories from this context is only deleted if the parameter
  222. !  * 'free_visited' is true. Be aware that the passed search_context is freed if
  223. !  * the reinitialization fails.
  224.    *
  225. !  * If you don't have a search context from a previous call 'search_ctx' must be
  226. !  * NULL.
  227.    *
  228.    * This function silently ignores a few errors, vim_findfile() will have
  229.    * limited functionality then.
  230.    */
  231.   /*ARGSUSED*/
  232.       void *
  233. ! vim_findfile_init(path, filename, stopdirs, level, free_visited, need_dir,
  234. !                         search_ctx, tagfile, rel_fname)
  235.       char_u    *path;
  236.       char_u    *filename;
  237.       char_u    *stopdirs;
  238.       int        level;
  239.       int        free_visited;
  240. !     int        need_dir;
  241. !     void    *search_ctx;
  242.       int        tagfile;
  243.       char_u    *rel_fname;    /* file name to use for "." */
  244.   {
  245.   #ifdef FEAT_PATH_EXTRA
  246. !     char_u    *wc_part;
  247.   #endif
  248. !     ff_stack_T    *sptr;
  249.   
  250.       /* If a search context is given by the caller, reuse it, else allocate a
  251.        * new one.
  252.        */
  253. !     if (search_ctx != NULL)
  254. !     ff_search_ctx = search_ctx;
  255.       else
  256.       {
  257. !     ff_search_ctx = (ff_search_ctx_T*)alloc(
  258. !                        (unsigned)sizeof(ff_search_ctx_T));
  259. !     if (ff_search_ctx == NULL)
  260.           goto error_return;
  261. !     memset(ff_search_ctx, 0, sizeof(ff_search_ctx_T));
  262.       }
  263.   
  264.       /* clear the search context, but NOT the visited lists */
  265. !     ff_clear();
  266.   
  267.       /* clear visited list if wanted */
  268.       if (free_visited == TRUE)
  269. !     vim_findfile_free_visited(ff_search_ctx);
  270.       else
  271.       {
  272.       /* Reuse old visited lists. Get the visited list for the given
  273.        * filename. If no list for the current filename exists, creates a new
  274. !      * one.
  275. !      */
  276. !     ff_search_ctx->ffsc_visited_list = ff_get_visited_list(filename,
  277. !                      &ff_search_ctx->ffsc_visited_lists_list);
  278. !     if (ff_search_ctx->ffsc_visited_list == NULL)
  279.           goto error_return;
  280. !     ff_search_ctx->ffsc_dir_visited_list = ff_get_visited_list(filename,
  281. !                  &ff_search_ctx->ffsc_dir_visited_lists_list);
  282. !     if (ff_search_ctx->ffsc_dir_visited_list == NULL)
  283.           goto error_return;
  284.       }
  285.   
  286. --- 3983,4056 ----
  287.    * The list of visited files/dirs can also be cleared with the function
  288.    * vim_findfile_free_visited().
  289.    *
  290. !  * Set the parameter 'find_what' to FINDFILE_DIR if you want to search for
  291. !  * directories only, FINDFILE_FILE for files only, FINDFILE_BOTH for both.
  292.    *
  293.    * A search context returned by a previous call to vim_findfile_init() can be
  294. !  * passed in the parameter "search_ctx_arg".  This context is reused and
  295. !  * reinitialized with the new parameters.  The list of already visited
  296.    * directories from this context is only deleted if the parameter
  297. !  * "free_visited" is true.  Be aware that the passed "search_ctx_arg" is freed
  298. !  * if the reinitialization fails.
  299.    *
  300. !  * If you don't have a search context from a previous call "search_ctx_arg"
  301. !  * must be NULL.
  302.    *
  303.    * This function silently ignores a few errors, vim_findfile() will have
  304.    * limited functionality then.
  305.    */
  306.   /*ARGSUSED*/
  307.       void *
  308. ! vim_findfile_init(path, filename, stopdirs, level, free_visited, find_what,
  309. !                        search_ctx_arg, tagfile, rel_fname)
  310.       char_u    *path;
  311.       char_u    *filename;
  312.       char_u    *stopdirs;
  313.       int        level;
  314.       int        free_visited;
  315. !     int        find_what;
  316. !     void    *search_ctx_arg;
  317.       int        tagfile;
  318.       char_u    *rel_fname;    /* file name to use for "." */
  319.   {
  320.   #ifdef FEAT_PATH_EXTRA
  321. !     char_u        *wc_part;
  322.   #endif
  323. !     ff_stack_T        *sptr;
  324. !     ff_search_ctx_T    *search_ctx;
  325.   
  326.       /* If a search context is given by the caller, reuse it, else allocate a
  327.        * new one.
  328.        */
  329. !     if (search_ctx_arg != NULL)
  330. !     search_ctx = search_ctx_arg;
  331.       else
  332.       {
  333. !     search_ctx = (ff_search_ctx_T*)alloc((unsigned)sizeof(ff_search_ctx_T));
  334. !     if (search_ctx == NULL)
  335.           goto error_return;
  336. !     memset(search_ctx, 0, sizeof(ff_search_ctx_T));
  337.       }
  338. +     search_ctx->ffsc_find_what = find_what;
  339.   
  340.       /* clear the search context, but NOT the visited lists */
  341. !     ff_clear(search_ctx);
  342.   
  343.       /* clear visited list if wanted */
  344.       if (free_visited == TRUE)
  345. !     vim_findfile_free_visited(search_ctx);
  346.       else
  347.       {
  348.       /* Reuse old visited lists. Get the visited list for the given
  349.        * filename. If no list for the current filename exists, creates a new
  350. !      * one. */
  351. !     search_ctx->ffsc_visited_list = ff_get_visited_list(filename,
  352. !                     &search_ctx->ffsc_visited_lists_list);
  353. !     if (search_ctx->ffsc_visited_list == NULL)
  354.           goto error_return;
  355. !     search_ctx->ffsc_dir_visited_list = ff_get_visited_list(filename,
  356. !                     &search_ctx->ffsc_dir_visited_lists_list);
  357. !     if (search_ctx->ffsc_dir_visited_list == NULL)
  358.           goto error_return;
  359.       }
  360.   
  361. ***************
  362. *** 4071,4082 ****
  363.       {
  364.           /* Make the start dir an absolute path name. */
  365.           vim_strncpy(ff_expand_buffer, rel_fname, len);
  366. !         ff_search_ctx->ffsc_start_dir = FullName_save(ff_expand_buffer,
  367. !                                        FALSE);
  368.       }
  369.       else
  370. !         ff_search_ctx->ffsc_start_dir = vim_strnsave(rel_fname, len);
  371. !     if (ff_search_ctx->ffsc_start_dir == NULL)
  372.           goto error_return;
  373.       if (*++path != NUL)
  374.           ++path;
  375. --- 4074,4084 ----
  376.       {
  377.           /* Make the start dir an absolute path name. */
  378.           vim_strncpy(ff_expand_buffer, rel_fname, len);
  379. !         search_ctx->ffsc_start_dir = FullName_save(ff_expand_buffer, FALSE);
  380.       }
  381.       else
  382. !         search_ctx->ffsc_start_dir = vim_strnsave(rel_fname, len);
  383. !     if (search_ctx->ffsc_start_dir == NULL)
  384.           goto error_return;
  385.       if (*++path != NUL)
  386.           ++path;
  387. ***************
  388. *** 4101,4108 ****
  389.       if (mch_dirname(ff_expand_buffer, MAXPATHL) == FAIL)
  390.           goto error_return;
  391.   
  392. !     ff_search_ctx->ffsc_start_dir = vim_strsave(ff_expand_buffer);
  393. !     if (ff_search_ctx->ffsc_start_dir == NULL)
  394.           goto error_return;
  395.   
  396.   #ifdef BACKSLASH_IN_FILENAME
  397. --- 4103,4110 ----
  398.       if (mch_dirname(ff_expand_buffer, MAXPATHL) == FAIL)
  399.           goto error_return;
  400.   
  401. !     search_ctx->ffsc_start_dir = vim_strsave(ff_expand_buffer);
  402. !     if (search_ctx->ffsc_start_dir == NULL)
  403.           goto error_return;
  404.   
  405.   #ifdef BACKSLASH_IN_FILENAME
  406. ***************
  407. *** 4110,4117 ****
  408.        * directory (but not for "//machine/dir").  Only use the drive name. */
  409.       if ((*path == '/' || *path == '\\')
  410.           && path[1] != path[0]
  411. !         && ff_search_ctx->ffsc_start_dir[1] == ':')
  412. !         ff_search_ctx->ffsc_start_dir[2] = NUL;
  413.   #endif
  414.       }
  415.   
  416. --- 4112,4119 ----
  417.        * directory (but not for "//machine/dir").  Only use the drive name. */
  418.       if ((*path == '/' || *path == '\\')
  419.           && path[1] != path[0]
  420. !         && search_ctx->ffsc_start_dir[1] == ':')
  421. !         search_ctx->ffsc_start_dir[2] = NUL;
  422.   #endif
  423.       }
  424.   
  425. ***************
  426. *** 4121,4127 ****
  427.        * If this fails (mem allocation), there is no upward search at all or a
  428.        * stop directory is not recognized -> continue silently.
  429.        * If stopdirs just contains a ";" or is empty,
  430. !      * ff_search_ctx->ffsc_stopdirs_v will only contain a  NULL pointer. This
  431.        * is handled as unlimited upward search.  See function
  432.        * ff_path_in_stoplist() for details.
  433.        */
  434. --- 4123,4129 ----
  435.        * If this fails (mem allocation), there is no upward search at all or a
  436.        * stop directory is not recognized -> continue silently.
  437.        * If stopdirs just contains a ";" or is empty,
  438. !      * search_ctx->ffsc_stopdirs_v will only contain a  NULL pointer. This
  439.        * is handled as unlimited upward search.  See function
  440.        * ff_path_in_stoplist() for details.
  441.        */
  442. ***************
  443. *** 4134,4143 ****
  444.           walker++;
  445.   
  446.       dircount = 1;
  447. !     ff_search_ctx->ffsc_stopdirs_v =
  448. !         (char_u **)alloc((unsigned)sizeof(char_u *));
  449.   
  450. !     if (ff_search_ctx->ffsc_stopdirs_v != NULL)
  451.       {
  452.           do
  453.           {
  454. --- 4136,4145 ----
  455.           walker++;
  456.   
  457.       dircount = 1;
  458. !     search_ctx->ffsc_stopdirs_v =
  459. !                  (char_u **)alloc((unsigned)sizeof(char_u *));
  460.   
  461. !     if (search_ctx->ffsc_stopdirs_v != NULL)
  462.       {
  463.           do
  464.           {
  465. ***************
  466. *** 4145,4181 ****
  467.           void    *ptr;
  468.   
  469.           helper = walker;
  470. !         ptr = vim_realloc(ff_search_ctx->ffsc_stopdirs_v,
  471.                          (dircount + 1) * sizeof(char_u *));
  472.           if (ptr)
  473. !             ff_search_ctx->ffsc_stopdirs_v = ptr;
  474.           else
  475.               /* ignore, keep what we have and continue */
  476.               break;
  477.           walker = vim_strchr(walker, ';');
  478.           if (walker)
  479.           {
  480. !             ff_search_ctx->ffsc_stopdirs_v[dircount-1] =
  481. !             vim_strnsave(helper, (int)(walker - helper));
  482.               walker++;
  483.           }
  484.           else
  485.               /* this might be "", which means ascent till top
  486.                * of directory tree.
  487.                */
  488. !             ff_search_ctx->ffsc_stopdirs_v[dircount-1] =
  489. !             vim_strsave(helper);
  490.   
  491.           dircount++;
  492.   
  493.           } while (walker != NULL);
  494. !         ff_search_ctx->ffsc_stopdirs_v[dircount-1] = NULL;
  495.       }
  496.       }
  497.   #endif
  498.   
  499.   #ifdef FEAT_PATH_EXTRA
  500. !     ff_search_ctx->ffsc_level = level;
  501.   
  502.       /* split into:
  503.        *  -fix path
  504. --- 4147,4183 ----
  505.           void    *ptr;
  506.   
  507.           helper = walker;
  508. !         ptr = vim_realloc(search_ctx->ffsc_stopdirs_v,
  509.                          (dircount + 1) * sizeof(char_u *));
  510.           if (ptr)
  511. !             search_ctx->ffsc_stopdirs_v = ptr;
  512.           else
  513.               /* ignore, keep what we have and continue */
  514.               break;
  515.           walker = vim_strchr(walker, ';');
  516.           if (walker)
  517.           {
  518. !             search_ctx->ffsc_stopdirs_v[dircount-1] =
  519. !                  vim_strnsave(helper, (int)(walker - helper));
  520.               walker++;
  521.           }
  522.           else
  523.               /* this might be "", which means ascent till top
  524.                * of directory tree.
  525.                */
  526. !             search_ctx->ffsc_stopdirs_v[dircount-1] =
  527. !                               vim_strsave(helper);
  528.   
  529.           dircount++;
  530.   
  531.           } while (walker != NULL);
  532. !         search_ctx->ffsc_stopdirs_v[dircount-1] = NULL;
  533.       }
  534.       }
  535.   #endif
  536.   
  537.   #ifdef FEAT_PATH_EXTRA
  538. !     search_ctx->ffsc_level = level;
  539.   
  540.       /* split into:
  541.        *  -fix path
  542. ***************
  543. *** 4189,4196 ****
  544.       char    *errpt;
  545.   
  546.       /* save the fix part of the path */
  547. !     ff_search_ctx->ffsc_fix_path = vim_strnsave(path,
  548. !                                (int)(wc_part - path));
  549.   
  550.       /*
  551.        * copy wc_path and add restricts to the '**' wildcard.
  552. --- 4191,4197 ----
  553.       char    *errpt;
  554.   
  555.       /* save the fix part of the path */
  556. !     search_ctx->ffsc_fix_path = vim_strnsave(path, (int)(wc_part - path));
  557.   
  558.       /*
  559.        * copy wc_path and add restricts to the '**' wildcard.
  560. ***************
  561. *** 4229,4275 ****
  562.           ff_expand_buffer[len++] = *wc_part++;
  563.       }
  564.       ff_expand_buffer[len] = NUL;
  565. !     ff_search_ctx->ffsc_wc_path = vim_strsave(ff_expand_buffer);
  566.   
  567. !     if (ff_search_ctx->ffsc_wc_path == NULL)
  568.           goto error_return;
  569.       }
  570.       else
  571.   #endif
  572. !     ff_search_ctx->ffsc_fix_path = vim_strsave(path);
  573.   
  574. !     if (ff_search_ctx->ffsc_start_dir == NULL)
  575.       {
  576.       /* store the fix part as startdir.
  577.        * This is needed if the parameter path is fully qualified.
  578.        */
  579. !     ff_search_ctx->ffsc_start_dir = vim_strsave(ff_search_ctx->ffsc_fix_path);
  580. !     if (ff_search_ctx->ffsc_start_dir)
  581. !         ff_search_ctx->ffsc_fix_path[0] = NUL;
  582.       }
  583.   
  584.       /* create an absolute path */
  585. !     STRCPY(ff_expand_buffer, ff_search_ctx->ffsc_start_dir);
  586.       add_pathsep(ff_expand_buffer);
  587. !     STRCAT(ff_expand_buffer, ff_search_ctx->ffsc_fix_path);
  588.       add_pathsep(ff_expand_buffer);
  589.   
  590.       sptr = ff_create_stack_element(ff_expand_buffer,
  591.   #ifdef FEAT_PATH_EXTRA
  592. !         ff_search_ctx->ffsc_wc_path,
  593.   #endif
  594.           level, 0);
  595.   
  596.       if (sptr == NULL)
  597.       goto error_return;
  598.   
  599. !     ff_push(sptr);
  600.   
  601. !     ff_search_ctx->ffsc_file_to_search = vim_strsave(filename);
  602. !     if (ff_search_ctx->ffsc_file_to_search == NULL)
  603.       goto error_return;
  604.   
  605. !     return ff_search_ctx;
  606.   
  607.   error_return:
  608.       /*
  609. --- 4230,4276 ----
  610.           ff_expand_buffer[len++] = *wc_part++;
  611.       }
  612.       ff_expand_buffer[len] = NUL;
  613. !     search_ctx->ffsc_wc_path = vim_strsave(ff_expand_buffer);
  614.   
  615. !     if (search_ctx->ffsc_wc_path == NULL)
  616.           goto error_return;
  617.       }
  618.       else
  619.   #endif
  620. !     search_ctx->ffsc_fix_path = vim_strsave(path);
  621.   
  622. !     if (search_ctx->ffsc_start_dir == NULL)
  623.       {
  624.       /* store the fix part as startdir.
  625.        * This is needed if the parameter path is fully qualified.
  626.        */
  627. !     search_ctx->ffsc_start_dir = vim_strsave(search_ctx->ffsc_fix_path);
  628. !     if (search_ctx->ffsc_start_dir)
  629. !         search_ctx->ffsc_fix_path[0] = NUL;
  630.       }
  631.   
  632.       /* create an absolute path */
  633. !     STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir);
  634.       add_pathsep(ff_expand_buffer);
  635. !     STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);
  636.       add_pathsep(ff_expand_buffer);
  637.   
  638.       sptr = ff_create_stack_element(ff_expand_buffer,
  639.   #ifdef FEAT_PATH_EXTRA
  640. !         search_ctx->ffsc_wc_path,
  641.   #endif
  642.           level, 0);
  643.   
  644.       if (sptr == NULL)
  645.       goto error_return;
  646.   
  647. !     ff_push(search_ctx, sptr);
  648.   
  649. !     search_ctx->ffsc_file_to_search = vim_strsave(filename);
  650. !     if (search_ctx->ffsc_file_to_search == NULL)
  651.       goto error_return;
  652.   
  653. !     return search_ctx;
  654.   
  655.   error_return:
  656.       /*
  657. ***************
  658. *** 4277,4283 ****
  659.        * Even when the caller gave us a (perhaps valid) context we free it here,
  660.        * as we might have already destroyed it.
  661.        */
  662. !     vim_findfile_cleanup(ff_search_ctx);
  663.       return NULL;
  664.   }
  665.   
  666. --- 4278,4284 ----
  667.        * Even when the caller gave us a (perhaps valid) context we free it here,
  668.        * as we might have already destroyed it.
  669.        */
  670. !     vim_findfile_cleanup(search_ctx);
  671.       return NULL;
  672.   }
  673.   
  674. ***************
  675. *** 4314,4320 ****
  676.   }
  677.   #endif
  678.   
  679. ! /* Clean up the given search context. Can handle a NULL pointer */
  680.       void
  681.   vim_findfile_cleanup(ctx)
  682.       void    *ctx;
  683. --- 4315,4323 ----
  684.   }
  685.   #endif
  686.   
  687. ! /*
  688. !  * Clean up the given search context. Can handle a NULL pointer.
  689. !  */
  690.       void
  691.   vim_findfile_cleanup(ctx)
  692.       void    *ctx;
  693. ***************
  694. *** 4322,4333 ****
  695.       if (ctx == NULL)
  696.       return;
  697.   
  698. -     ff_search_ctx = ctx;
  699.       vim_findfile_free_visited(ctx);
  700. !     ff_clear();
  701.       vim_free(ctx);
  702. -     ff_search_ctx = NULL;
  703.   }
  704.   
  705.   /*
  706. --- 4325,4333 ----
  707.       if (ctx == NULL)
  708.       return;
  709.   
  710.       vim_findfile_free_visited(ctx);
  711. !     ff_clear(ctx);
  712.       vim_free(ctx);
  713.   }
  714.   
  715.   /*
  716. ***************
  717. *** 4343,4357 ****
  718.    * top of the list).
  719.    */
  720.       char_u *
  721. ! vim_findfile(search_ctx)
  722. !     void    *search_ctx;
  723.   {
  724.       char_u    *file_path;
  725.   #ifdef FEAT_PATH_EXTRA
  726.       char_u    *rest_of_wildcards;
  727.       char_u    *path_end = NULL;
  728.   #endif
  729. !     ff_stack_T    *ctx;
  730.   #if defined(FEAT_SEARCHPATH) || defined(FEAT_PATH_EXTRA)
  731.       int        len;
  732.   #endif
  733. --- 4343,4357 ----
  734.    * top of the list).
  735.    */
  736.       char_u *
  737. ! vim_findfile(search_ctx_arg)
  738. !     void    *search_ctx_arg;
  739.   {
  740.       char_u    *file_path;
  741.   #ifdef FEAT_PATH_EXTRA
  742.       char_u    *rest_of_wildcards;
  743.       char_u    *path_end = NULL;
  744.   #endif
  745. !     ff_stack_T    *stackp;
  746.   #if defined(FEAT_SEARCHPATH) || defined(FEAT_PATH_EXTRA)
  747.       int        len;
  748.   #endif
  749. ***************
  750. *** 4360,4370 ****
  751.   #ifdef FEAT_SEARCHPATH
  752.       char_u    *suf;
  753.   #endif
  754.   
  755. !     if (search_ctx == NULL)
  756.       return NULL;
  757.   
  758. !     ff_search_ctx = (ff_search_ctx_T*)search_ctx;
  759.   
  760.       /*
  761.        * filepath is used as buffer for various actions and as the storage to
  762. --- 4360,4371 ----
  763.   #ifdef FEAT_SEARCHPATH
  764.       char_u    *suf;
  765.   #endif
  766. +     ff_search_ctx_T *search_ctx;
  767.   
  768. !     if (search_ctx_arg == NULL)
  769.       return NULL;
  770.   
  771. !     search_ctx = (ff_search_ctx_T *)search_ctx_arg;
  772.   
  773.       /*
  774.        * filepath is used as buffer for various actions and as the storage to
  775. ***************
  776. *** 4375,4382 ****
  777.   
  778.   #ifdef FEAT_PATH_EXTRA
  779.       /* store the end of the start dir -- needed for upward search */
  780. !     if (ff_search_ctx->ffsc_start_dir != NULL)
  781. !     path_end = &ff_search_ctx->ffsc_start_dir[STRLEN(ff_search_ctx->ffsc_start_dir)];
  782.   #endif
  783.   
  784.   #ifdef FEAT_PATH_EXTRA
  785. --- 4376,4384 ----
  786.   
  787.   #ifdef FEAT_PATH_EXTRA
  788.       /* store the end of the start dir -- needed for upward search */
  789. !     if (search_ctx->ffsc_start_dir != NULL)
  790. !     path_end = &search_ctx->ffsc_start_dir[
  791. !                       STRLEN(search_ctx->ffsc_start_dir)];
  792.   #endif
  793.   
  794.   #ifdef FEAT_PATH_EXTRA
  795. ***************
  796. *** 4393,4400 ****
  797.           break;
  798.   
  799.           /* get directory to work on from stack */
  800. !         ctx = ff_pop();
  801. !         if (ctx == NULL)
  802.           break;
  803.   
  804.           /*
  805. --- 4395,4402 ----
  806.           break;
  807.   
  808.           /* get directory to work on from stack */
  809. !         stackp = ff_pop(search_ctx);
  810. !         if (stackp == NULL)
  811.           break;
  812.   
  813.           /*
  814. ***************
  815. *** 4414,4427 ****
  816.            *  /etc/rc.d/init.d is linked to /etc/rc.d -> endless loop)
  817.            *
  818.            * This check is only needed for directories we work on for the
  819. !          * first time (hence ctx->ff_filearray == NULL)
  820.            */
  821. !         if (ctx->ffs_filearray == NULL
  822. !             && ff_check_visited(&ff_search_ctx->ffsc_dir_visited_list
  823.                                 ->ffvl_visited_list,
  824. !             ctx->ffs_fix_path
  825.   #ifdef FEAT_PATH_EXTRA
  826. !             , ctx->ffs_wc_path
  827.   #endif
  828.               ) == FAIL)
  829.           {
  830. --- 4416,4429 ----
  831.            *  /etc/rc.d/init.d is linked to /etc/rc.d -> endless loop)
  832.            *
  833.            * This check is only needed for directories we work on for the
  834. !          * first time (hence stackp->ff_filearray == NULL)
  835.            */
  836. !         if (stackp->ffs_filearray == NULL
  837. !             && ff_check_visited(&search_ctx->ffsc_dir_visited_list
  838.                                 ->ffvl_visited_list,
  839. !             stackp->ffs_fix_path
  840.   #ifdef FEAT_PATH_EXTRA
  841. !             , stackp->ffs_wc_path
  842.   #endif
  843.               ) == FAIL)
  844.           {
  845. ***************
  846. *** 4430,4442 ****
  847.           {
  848.               verbose_enter_scroll();
  849.               smsg((char_u *)"Already Searched: %s (%s)",
  850. !                        ctx->ffs_fix_path, ctx->ffs_wc_path);
  851.               /* don't overwrite this either */
  852.               msg_puts((char_u *)"\n");
  853.               verbose_leave_scroll();
  854.           }
  855.   #endif
  856. !         ff_free_stack_element(ctx);
  857.           continue;
  858.           }
  859.   #ifdef FF_VERBOSE
  860. --- 4432,4444 ----
  861.           {
  862.               verbose_enter_scroll();
  863.               smsg((char_u *)"Already Searched: %s (%s)",
  864. !                    stackp->ffs_fix_path, stackp->ffs_wc_path);
  865.               /* don't overwrite this either */
  866.               msg_puts((char_u *)"\n");
  867.               verbose_leave_scroll();
  868.           }
  869.   #endif
  870. !         ff_free_stack_element(stackp);
  871.           continue;
  872.           }
  873.   #ifdef FF_VERBOSE
  874. ***************
  875. *** 4444,4450 ****
  876.           {
  877.           verbose_enter_scroll();
  878.           smsg((char_u *)"Searching: %s (%s)",
  879. !                      ctx->ffs_fix_path, ctx->ffs_wc_path);
  880.           /* don't overwrite this either */
  881.           msg_puts((char_u *)"\n");
  882.           verbose_leave_scroll();
  883. --- 4446,4452 ----
  884.           {
  885.           verbose_enter_scroll();
  886.           smsg((char_u *)"Searching: %s (%s)",
  887. !                    stackp->ffs_fix_path, stackp->ffs_wc_path);
  888.           /* don't overwrite this either */
  889.           msg_puts((char_u *)"\n");
  890.           verbose_leave_scroll();
  891. ***************
  892. *** 4452,4460 ****
  893.   #endif
  894.   
  895.           /* check depth */
  896. !         if (ctx->ffs_level <= 0)
  897.           {
  898. !         ff_free_stack_element(ctx);
  899.           continue;
  900.           }
  901.   
  902. --- 4454,4462 ----
  903.   #endif
  904.   
  905.           /* check depth */
  906. !         if (stackp->ffs_level <= 0)
  907.           {
  908. !         ff_free_stack_element(stackp);
  909.           continue;
  910.           }
  911.   
  912. ***************
  913. *** 4466,4472 ****
  914.            * and all possible expands are returned in one array. We use this
  915.            * to handle the expansion of '**' into an empty string.
  916.            */
  917. !         if (ctx->ffs_filearray == NULL)
  918.           {
  919.           char_u *dirptrs[2];
  920.   
  921. --- 4468,4474 ----
  922.            * and all possible expands are returned in one array. We use this
  923.            * to handle the expansion of '**' into an empty string.
  924.            */
  925. !         if (stackp->ffs_filearray == NULL)
  926.           {
  927.           char_u *dirptrs[2];
  928.   
  929. ***************
  930. *** 4477,4495 ****
  931.           dirptrs[1] = NULL;
  932.   
  933.           /* if we have a start dir copy it in */
  934. !         if (!vim_isAbsName(ctx->ffs_fix_path)
  935. !             && ff_search_ctx->ffsc_start_dir)
  936.           {
  937. !             STRCPY(file_path, ff_search_ctx->ffsc_start_dir);
  938.               add_pathsep(file_path);
  939.           }
  940.   
  941.           /* append the fix part of the search path */
  942. !         STRCAT(file_path, ctx->ffs_fix_path);
  943.           add_pathsep(file_path);
  944.   
  945.   #ifdef FEAT_PATH_EXTRA
  946. !         rest_of_wildcards = ctx->ffs_wc_path;
  947.           if (*rest_of_wildcards != NUL)
  948.           {
  949.               len = (int)STRLEN(file_path);
  950. --- 4479,4497 ----
  951.           dirptrs[1] = NULL;
  952.   
  953.           /* if we have a start dir copy it in */
  954. !         if (!vim_isAbsName(stackp->ffs_fix_path)
  955. !                         && search_ctx->ffsc_start_dir)
  956.           {
  957. !             STRCPY(file_path, search_ctx->ffsc_start_dir);
  958.               add_pathsep(file_path);
  959.           }
  960.   
  961.           /* append the fix part of the search path */
  962. !         STRCAT(file_path, stackp->ffs_fix_path);
  963.           add_pathsep(file_path);
  964.   
  965.   #ifdef FEAT_PATH_EXTRA
  966. !         rest_of_wildcards = stackp->ffs_wc_path;
  967.           if (*rest_of_wildcards != NUL)
  968.           {
  969.               len = (int)STRLEN(file_path);
  970. ***************
  971. *** 4516,4526 ****
  972.               else
  973.                   rest_of_wildcards += 3;
  974.   
  975. !             if (ctx->ffs_star_star_empty == 0)
  976.               {
  977.                   /* if not done before, expand '**' to empty */
  978. !                 ctx->ffs_star_star_empty = 1;
  979. !                 dirptrs[1] = ctx->ffs_fix_path;
  980.               }
  981.               }
  982.   
  983. --- 4518,4528 ----
  984.               else
  985.                   rest_of_wildcards += 3;
  986.   
  987. !             if (stackp->ffs_star_star_empty == 0)
  988.               {
  989.                   /* if not done before, expand '**' to empty */
  990. !                 stackp->ffs_star_star_empty = 1;
  991. !                 dirptrs[1] = stackp->ffs_fix_path;
  992.               }
  993.               }
  994.   
  995. ***************
  996. *** 4547,4576 ****
  997.            */
  998.           if (path_with_url(dirptrs[0]))
  999.           {
  1000. !             ctx->ffs_filearray = (char_u **)
  1001.                             alloc((unsigned)sizeof(char *));
  1002. !             if (ctx->ffs_filearray != NULL
  1003. !                 && (ctx->ffs_filearray[0]
  1004.                   = vim_strsave(dirptrs[0])) != NULL)
  1005. !             ctx->ffs_filearray_size = 1;
  1006.               else
  1007. !             ctx->ffs_filearray_size = 0;
  1008.           }
  1009.           else
  1010.               expand_wildcards((dirptrs[1] == NULL) ? 1 : 2, dirptrs,
  1011. !                 &ctx->ffs_filearray_size,
  1012. !                 &ctx->ffs_filearray,
  1013.                   EW_DIR|EW_ADDSLASH|EW_SILENT);
  1014.   
  1015. !         ctx->ffs_filearray_cur = 0;
  1016. !         ctx->ffs_stage = 0;
  1017.           }
  1018.   #ifdef FEAT_PATH_EXTRA
  1019.           else
  1020. !         rest_of_wildcards = &ctx->ffs_wc_path[STRLEN(ctx->ffs_wc_path)];
  1021.   #endif
  1022.   
  1023. !         if (ctx->ffs_stage == 0)
  1024.           {
  1025.           /* this is the first time we work on this directory */
  1026.   #ifdef FEAT_PATH_EXTRA
  1027. --- 4549,4579 ----
  1028.            */
  1029.           if (path_with_url(dirptrs[0]))
  1030.           {
  1031. !             stackp->ffs_filearray = (char_u **)
  1032.                             alloc((unsigned)sizeof(char *));
  1033. !             if (stackp->ffs_filearray != NULL
  1034. !                 && (stackp->ffs_filearray[0]
  1035.                   = vim_strsave(dirptrs[0])) != NULL)
  1036. !             stackp->ffs_filearray_size = 1;
  1037.               else
  1038. !             stackp->ffs_filearray_size = 0;
  1039.           }
  1040.           else
  1041.               expand_wildcards((dirptrs[1] == NULL) ? 1 : 2, dirptrs,
  1042. !                 &stackp->ffs_filearray_size,
  1043. !                 &stackp->ffs_filearray,
  1044.                   EW_DIR|EW_ADDSLASH|EW_SILENT);
  1045.   
  1046. !         stackp->ffs_filearray_cur = 0;
  1047. !         stackp->ffs_stage = 0;
  1048.           }
  1049.   #ifdef FEAT_PATH_EXTRA
  1050.           else
  1051. !         rest_of_wildcards = &stackp->ffs_wc_path[
  1052. !                          STRLEN(stackp->ffs_wc_path)];
  1053.   #endif
  1054.   
  1055. !         if (stackp->ffs_stage == 0)
  1056.           {
  1057.           /* this is the first time we work on this directory */
  1058.   #ifdef FEAT_PATH_EXTRA
  1059. ***************
  1060. *** 4581,4598 ****
  1061.                * we don't have further wildcards to expand, so we have to
  1062.                * check for the final file now
  1063.                */
  1064. !             for (i = ctx->ffs_filearray_cur;
  1065. !                          i < ctx->ffs_filearray_size; ++i)
  1066.               {
  1067. !             if (!path_with_url(ctx->ffs_filearray[i])
  1068. !                      && !mch_isdir(ctx->ffs_filearray[i]))
  1069.                   continue;   /* not a directory */
  1070.   
  1071.               /* prepare the filename to be checked for existance
  1072.                * below */
  1073. !             STRCPY(file_path, ctx->ffs_filearray[i]);
  1074.               add_pathsep(file_path);
  1075. !             STRCAT(file_path, ff_search_ctx->ffsc_file_to_search);
  1076.   
  1077.               /*
  1078.                * Try without extra suffix and then with suffixes
  1079. --- 4584,4601 ----
  1080.                * we don't have further wildcards to expand, so we have to
  1081.                * check for the final file now
  1082.                */
  1083. !             for (i = stackp->ffs_filearray_cur;
  1084. !                       i < stackp->ffs_filearray_size; ++i)
  1085.               {
  1086. !             if (!path_with_url(stackp->ffs_filearray[i])
  1087. !                       && !mch_isdir(stackp->ffs_filearray[i]))
  1088.                   continue;   /* not a directory */
  1089.   
  1090.               /* prepare the filename to be checked for existance
  1091.                * below */
  1092. !             STRCPY(file_path, stackp->ffs_filearray[i]);
  1093.               add_pathsep(file_path);
  1094. !             STRCAT(file_path, search_ctx->ffsc_file_to_search);
  1095.   
  1096.               /*
  1097.                * Try without extra suffix and then with suffixes
  1098. ***************
  1099. *** 4606,4617 ****
  1100.               {
  1101.                   /* if file exists and we didn't already find it */
  1102.                   if ((path_with_url(file_path)
  1103. !                     || (mch_getperm(file_path) >= 0
  1104. !                         && (!ff_search_ctx->ffsc_need_dir
  1105. !                         || mch_isdir(file_path))))
  1106.   #ifndef FF_VERBOSE
  1107.                       && (ff_check_visited(
  1108. !                         &ff_search_ctx->ffsc_visited_list->ffvl_visited_list,
  1109.                           file_path
  1110.   #ifdef FEAT_PATH_EXTRA
  1111.                           , (char_u *)""
  1112. --- 4609,4623 ----
  1113.               {
  1114.                   /* if file exists and we didn't already find it */
  1115.                   if ((path_with_url(file_path)
  1116. !                   || (mch_getperm(file_path) >= 0
  1117. !                       && (search_ctx->ffsc_find_what
  1118. !                                   == FINDFILE_BOTH
  1119. !                       || ((search_ctx->ffsc_find_what
  1120. !                                   == FINDFILE_DIR)
  1121. !                            == mch_isdir(file_path)))))
  1122.   #ifndef FF_VERBOSE
  1123.                       && (ff_check_visited(
  1124. !                         &search_ctx->ffsc_visited_list->ffvl_visited_list,
  1125.                           file_path
  1126.   #ifdef FEAT_PATH_EXTRA
  1127.                           , (char_u *)""
  1128. ***************
  1129. *** 4622,4628 ****
  1130.                   {
  1131.   #ifdef FF_VERBOSE
  1132.                   if (ff_check_visited(
  1133. !                         &ff_search_ctx->ffsc_visited_list->ffvl_visited_list,
  1134.                           file_path
  1135.   #ifdef FEAT_PATH_EXTRA
  1136.                           , (char_u *)""
  1137. --- 4628,4634 ----
  1138.                   {
  1139.   #ifdef FF_VERBOSE
  1140.                   if (ff_check_visited(
  1141. !                         &search_ctx->ffsc_visited_list->ffvl_visited_list,
  1142.                           file_path
  1143.   #ifdef FEAT_PATH_EXTRA
  1144.                           , (char_u *)""
  1145. ***************
  1146. *** 4643,4650 ****
  1147.   #endif
  1148.   
  1149.                   /* push dir to examine rest of subdirs later */
  1150. !                 ctx->ffs_filearray_cur = i + 1;
  1151. !                 ff_push(ctx);
  1152.   
  1153.                   simplify_filename(file_path);
  1154.                   if (mch_dirname(ff_expand_buffer, MAXPATHL)
  1155. --- 4649,4656 ----
  1156.   #endif
  1157.   
  1158.                   /* push dir to examine rest of subdirs later */
  1159. !                 stackp->ffs_filearray_cur = i + 1;
  1160. !                 ff_push(search_ctx, stackp);
  1161.   
  1162.                   simplify_filename(file_path);
  1163.                   if (mch_dirname(ff_expand_buffer, MAXPATHL)
  1164. ***************
  1165. *** 4686,4704 ****
  1166.                * still wildcards left, push the directories for further
  1167.                * search
  1168.                */
  1169. !             for (i = ctx->ffs_filearray_cur;
  1170. !                          i < ctx->ffs_filearray_size; ++i)
  1171.               {
  1172. !             if (!mch_isdir(ctx->ffs_filearray[i]))
  1173.                   continue;    /* not a directory */
  1174.   
  1175. !             ff_push(ff_create_stack_element(ctx->ffs_filearray[i],
  1176. !                       rest_of_wildcards, ctx->ffs_level - 1, 0));
  1177.               }
  1178.           }
  1179.   #endif
  1180. !         ctx->ffs_filearray_cur = 0;
  1181. !         ctx->ffs_stage = 1;
  1182.           }
  1183.   
  1184.   #ifdef FEAT_PATH_EXTRA
  1185. --- 4692,4713 ----
  1186.                * still wildcards left, push the directories for further
  1187.                * search
  1188.                */
  1189. !             for (i = stackp->ffs_filearray_cur;
  1190. !                       i < stackp->ffs_filearray_size; ++i)
  1191.               {
  1192. !             if (!mch_isdir(stackp->ffs_filearray[i]))
  1193.                   continue;    /* not a directory */
  1194.   
  1195. !             ff_push(search_ctx,
  1196. !                 ff_create_stack_element(
  1197. !                              stackp->ffs_filearray[i],
  1198. !                              rest_of_wildcards,
  1199. !                              stackp->ffs_level - 1, 0));
  1200.               }
  1201.           }
  1202.   #endif
  1203. !         stackp->ffs_filearray_cur = 0;
  1204. !         stackp->ffs_stage = 1;
  1205.           }
  1206.   
  1207.   #ifdef FEAT_PATH_EXTRA
  1208. ***************
  1209. *** 4706,4728 ****
  1210.            * if wildcards contains '**' we have to descent till we reach the
  1211.            * leaves of the directory tree.
  1212.            */
  1213. !         if (STRNCMP(ctx->ffs_wc_path, "**", 2) == 0)
  1214.           {
  1215. !         for (i = ctx->ffs_filearray_cur;
  1216. !                          i < ctx->ffs_filearray_size; ++i)
  1217.           {
  1218. !             if (fnamecmp(ctx->ffs_filearray[i], ctx->ffs_fix_path) == 0)
  1219.               continue; /* don't repush same directory */
  1220. !             if (!mch_isdir(ctx->ffs_filearray[i]))
  1221.               continue;   /* not a directory */
  1222. !             ff_push(ff_create_stack_element(ctx->ffs_filearray[i],
  1223. !                 ctx->ffs_wc_path, ctx->ffs_level - 1, 1));
  1224.           }
  1225.           }
  1226.   #endif
  1227.   
  1228.           /* we are done with the current directory */
  1229. !         ff_free_stack_element(ctx);
  1230.   
  1231.       }
  1232.   
  1233. --- 4715,4739 ----
  1234.            * if wildcards contains '**' we have to descent till we reach the
  1235.            * leaves of the directory tree.
  1236.            */
  1237. !         if (STRNCMP(stackp->ffs_wc_path, "**", 2) == 0)
  1238.           {
  1239. !         for (i = stackp->ffs_filearray_cur;
  1240. !                       i < stackp->ffs_filearray_size; ++i)
  1241.           {
  1242. !             if (fnamecmp(stackp->ffs_filearray[i],
  1243. !                            stackp->ffs_fix_path) == 0)
  1244.               continue; /* don't repush same directory */
  1245. !             if (!mch_isdir(stackp->ffs_filearray[i]))
  1246.               continue;   /* not a directory */
  1247. !             ff_push(search_ctx,
  1248. !                 ff_create_stack_element(stackp->ffs_filearray[i],
  1249. !                 stackp->ffs_wc_path, stackp->ffs_level - 1, 1));
  1250.           }
  1251.           }
  1252.   #endif
  1253.   
  1254.           /* we are done with the current directory */
  1255. !         ff_free_stack_element(stackp);
  1256.   
  1257.       }
  1258.   
  1259. ***************
  1260. *** 4730,4769 ****
  1261.       /* If we reached this, we didn't find anything downwards.
  1262.        * Let's check if we should do an upward search.
  1263.        */
  1264. !     if (ff_search_ctx->ffsc_start_dir
  1265. !         && ff_search_ctx->ffsc_stopdirs_v != NULL && !got_int)
  1266.       {
  1267.           ff_stack_T  *sptr;
  1268.   
  1269.           /* is the last starting directory in the stop list? */
  1270. !         if (ff_path_in_stoplist(ff_search_ctx->ffsc_start_dir,
  1271. !                (int)(path_end - ff_search_ctx->ffsc_start_dir),
  1272. !                ff_search_ctx->ffsc_stopdirs_v) == TRUE)
  1273.           break;
  1274.   
  1275.           /* cut of last dir */
  1276. !         while (path_end > ff_search_ctx->ffsc_start_dir
  1277. !             && vim_ispathsep(*path_end))
  1278.           path_end--;
  1279. !         while (path_end > ff_search_ctx->ffsc_start_dir
  1280. !             && !vim_ispathsep(path_end[-1]))
  1281.           path_end--;
  1282.           *path_end = 0;
  1283.           path_end--;
  1284.   
  1285. !         if (*ff_search_ctx->ffsc_start_dir == 0)
  1286.           break;
  1287.   
  1288. !         STRCPY(file_path, ff_search_ctx->ffsc_start_dir);
  1289.           add_pathsep(file_path);
  1290. !         STRCAT(file_path, ff_search_ctx->ffsc_fix_path);
  1291.   
  1292.           /* create a new stack entry */
  1293.           sptr = ff_create_stack_element(file_path,
  1294. !             ff_search_ctx->ffsc_wc_path, ff_search_ctx->ffsc_level, 0);
  1295.           if (sptr == NULL)
  1296.           break;
  1297. !         ff_push(sptr);
  1298.       }
  1299.       else
  1300.           break;
  1301. --- 4741,4780 ----
  1302.       /* If we reached this, we didn't find anything downwards.
  1303.        * Let's check if we should do an upward search.
  1304.        */
  1305. !     if (search_ctx->ffsc_start_dir
  1306. !         && search_ctx->ffsc_stopdirs_v != NULL && !got_int)
  1307.       {
  1308.           ff_stack_T  *sptr;
  1309.   
  1310.           /* is the last starting directory in the stop list? */
  1311. !         if (ff_path_in_stoplist(search_ctx->ffsc_start_dir,
  1312. !                (int)(path_end - search_ctx->ffsc_start_dir),
  1313. !                search_ctx->ffsc_stopdirs_v) == TRUE)
  1314.           break;
  1315.   
  1316.           /* cut of last dir */
  1317. !         while (path_end > search_ctx->ffsc_start_dir
  1318. !                           && vim_ispathsep(*path_end))
  1319.           path_end--;
  1320. !         while (path_end > search_ctx->ffsc_start_dir
  1321. !                           && !vim_ispathsep(path_end[-1]))
  1322.           path_end--;
  1323.           *path_end = 0;
  1324.           path_end--;
  1325.   
  1326. !         if (*search_ctx->ffsc_start_dir == 0)
  1327.           break;
  1328.   
  1329. !         STRCPY(file_path, search_ctx->ffsc_start_dir);
  1330.           add_pathsep(file_path);
  1331. !         STRCAT(file_path, search_ctx->ffsc_fix_path);
  1332.   
  1333.           /* create a new stack entry */
  1334.           sptr = ff_create_stack_element(file_path,
  1335. !             search_ctx->ffsc_wc_path, search_ctx->ffsc_level, 0);
  1336.           if (sptr == NULL)
  1337.           break;
  1338. !         ff_push(search_ctx, sptr);
  1339.       }
  1340.       else
  1341.           break;
  1342. ***************
  1343. *** 4779,4794 ****
  1344.    * Can handle it if the passed search_context is NULL;
  1345.    */
  1346.       void
  1347. ! vim_findfile_free_visited(search_ctx)
  1348. !     void    *search_ctx;
  1349.   {
  1350. !     if (search_ctx == NULL)
  1351. !     return;
  1352.   
  1353. !     ff_search_ctx = (ff_search_ctx_T *)search_ctx;
  1354.   
  1355. !     vim_findfile_free_visited_list(&ff_search_ctx->ffsc_visited_lists_list);
  1356. !     vim_findfile_free_visited_list(&ff_search_ctx->ffsc_dir_visited_lists_list);
  1357.   }
  1358.   
  1359.       static void
  1360. --- 4790,4806 ----
  1361.    * Can handle it if the passed search_context is NULL;
  1362.    */
  1363.       void
  1364. ! vim_findfile_free_visited(search_ctx_arg)
  1365. !     void    *search_ctx_arg;
  1366.   {
  1367. !     ff_search_ctx_T *search_ctx;
  1368.   
  1369. !     if (search_ctx_arg == NULL)
  1370. !     return;
  1371.   
  1372. !     search_ctx = (ff_search_ctx_T *)search_ctx_arg;
  1373. !     vim_findfile_free_visited_list(&search_ctx->ffsc_visited_lists_list);
  1374. !     vim_findfile_free_visited_list(&search_ctx->ffsc_dir_visited_lists_list);
  1375.   }
  1376.   
  1377.       static void
  1378. ***************
  1379. *** 5103,5135 ****
  1380.   }
  1381.   
  1382.   /*
  1383. !  * push a dir on the directory stack
  1384.    */
  1385.       static void
  1386. ! ff_push(ctx)
  1387. !     ff_stack_T *ctx;
  1388.   {
  1389.       /* check for NULL pointer, not to return an error to the user, but
  1390.        * to prevent a crash */
  1391. !     if (ctx != NULL)
  1392.       {
  1393. !     ctx->ffs_prev   = ff_search_ctx->ffsc_stack_ptr;
  1394. !     ff_search_ctx->ffsc_stack_ptr = ctx;
  1395.       }
  1396.   }
  1397.   
  1398.   /*
  1399. !  * pop a dir from the directory stack
  1400. !  * returns NULL if stack is empty
  1401.    */
  1402.       static ff_stack_T *
  1403. ! ff_pop()
  1404.   {
  1405.       ff_stack_T  *sptr;
  1406.   
  1407. !     sptr = ff_search_ctx->ffsc_stack_ptr;
  1408. !     if (ff_search_ctx->ffsc_stack_ptr != NULL)
  1409. !     ff_search_ctx->ffsc_stack_ptr = ff_search_ctx->ffsc_stack_ptr->ffs_prev;
  1410.   
  1411.       return sptr;
  1412.   }
  1413. --- 5115,5149 ----
  1414.   }
  1415.   
  1416.   /*
  1417. !  * Push a dir on the directory stack.
  1418.    */
  1419.       static void
  1420. ! ff_push(search_ctx, stack_ptr)
  1421. !     ff_search_ctx_T *search_ctx;
  1422. !     ff_stack_T        *stack_ptr;
  1423.   {
  1424.       /* check for NULL pointer, not to return an error to the user, but
  1425.        * to prevent a crash */
  1426. !     if (stack_ptr != NULL)
  1427.       {
  1428. !     stack_ptr->ffs_prev = search_ctx->ffsc_stack_ptr;
  1429. !     search_ctx->ffsc_stack_ptr = stack_ptr;
  1430.       }
  1431.   }
  1432.   
  1433.   /*
  1434. !  * Pop a dir from the directory stack.
  1435. !  * Returns NULL if stack is empty.
  1436.    */
  1437.       static ff_stack_T *
  1438. ! ff_pop(search_ctx)
  1439. !     ff_search_ctx_T *search_ctx;
  1440.   {
  1441.       ff_stack_T  *sptr;
  1442.   
  1443. !     sptr = search_ctx->ffsc_stack_ptr;
  1444. !     if (search_ctx->ffsc_stack_ptr != NULL)
  1445. !     search_ctx->ffsc_stack_ptr = search_ctx->ffsc_stack_ptr->ffs_prev;
  1446.   
  1447.       return sptr;
  1448.   }
  1449. ***************
  1450. *** 5138,5199 ****
  1451.    * free the given stack element
  1452.    */
  1453.       static void
  1454. ! ff_free_stack_element(ctx)
  1455. !     ff_stack_T  *ctx;
  1456.   {
  1457.       /* vim_free handles possible NULL pointers */
  1458. !     vim_free(ctx->ffs_fix_path);
  1459.   #ifdef FEAT_PATH_EXTRA
  1460. !     vim_free(ctx->ffs_wc_path);
  1461.   #endif
  1462.   
  1463. !     if (ctx->ffs_filearray != NULL)
  1464. !     FreeWild(ctx->ffs_filearray_size, ctx->ffs_filearray);
  1465.   
  1466. !     vim_free(ctx);
  1467.   }
  1468.   
  1469.   /*
  1470. !  * clear the search context
  1471.    */
  1472.       static void
  1473. ! ff_clear()
  1474.   {
  1475.       ff_stack_T   *sptr;
  1476.   
  1477.       /* clear up stack */
  1478. !     while ((sptr = ff_pop()) != NULL)
  1479.       ff_free_stack_element(sptr);
  1480.   
  1481. !     vim_free(ff_search_ctx->ffsc_file_to_search);
  1482. !     vim_free(ff_search_ctx->ffsc_start_dir);
  1483. !     vim_free(ff_search_ctx->ffsc_fix_path);
  1484.   #ifdef FEAT_PATH_EXTRA
  1485. !     vim_free(ff_search_ctx->ffsc_wc_path);
  1486.   #endif
  1487.   
  1488.   #ifdef FEAT_PATH_EXTRA
  1489. !     if (ff_search_ctx->ffsc_stopdirs_v != NULL)
  1490.       {
  1491.       int  i = 0;
  1492.   
  1493. !     while (ff_search_ctx->ffsc_stopdirs_v[i] != NULL)
  1494.       {
  1495. !         vim_free(ff_search_ctx->ffsc_stopdirs_v[i]);
  1496.           i++;
  1497.       }
  1498. !     vim_free(ff_search_ctx->ffsc_stopdirs_v);
  1499.       }
  1500. !     ff_search_ctx->ffsc_stopdirs_v = NULL;
  1501.   #endif
  1502.   
  1503.       /* reset everything */
  1504. !     ff_search_ctx->ffsc_file_to_search    = NULL;
  1505. !     ff_search_ctx->ffsc_start_dir    = NULL;
  1506. !     ff_search_ctx->ffsc_fix_path    = NULL;
  1507.   #ifdef FEAT_PATH_EXTRA
  1508. !     ff_search_ctx->ffsc_wc_path        = NULL;
  1509. !     ff_search_ctx->ffsc_level        = 0;
  1510.   #endif
  1511.   }
  1512.   
  1513. --- 5152,5214 ----
  1514.    * free the given stack element
  1515.    */
  1516.       static void
  1517. ! ff_free_stack_element(stack_ptr)
  1518. !     ff_stack_T  *stack_ptr;
  1519.   {
  1520.       /* vim_free handles possible NULL pointers */
  1521. !     vim_free(stack_ptr->ffs_fix_path);
  1522.   #ifdef FEAT_PATH_EXTRA
  1523. !     vim_free(stack_ptr->ffs_wc_path);
  1524.   #endif
  1525.   
  1526. !     if (stack_ptr->ffs_filearray != NULL)
  1527. !     FreeWild(stack_ptr->ffs_filearray_size, stack_ptr->ffs_filearray);
  1528.   
  1529. !     vim_free(stack_ptr);
  1530.   }
  1531.   
  1532.   /*
  1533. !  * Clear the search context, but NOT the visited list.
  1534.    */
  1535.       static void
  1536. ! ff_clear(search_ctx)
  1537. !     ff_search_ctx_T *search_ctx;
  1538.   {
  1539.       ff_stack_T   *sptr;
  1540.   
  1541.       /* clear up stack */
  1542. !     while ((sptr = ff_pop(search_ctx)) != NULL)
  1543.       ff_free_stack_element(sptr);
  1544.   
  1545. !     vim_free(search_ctx->ffsc_file_to_search);
  1546. !     vim_free(search_ctx->ffsc_start_dir);
  1547. !     vim_free(search_ctx->ffsc_fix_path);
  1548.   #ifdef FEAT_PATH_EXTRA
  1549. !     vim_free(search_ctx->ffsc_wc_path);
  1550.   #endif
  1551.   
  1552.   #ifdef FEAT_PATH_EXTRA
  1553. !     if (search_ctx->ffsc_stopdirs_v != NULL)
  1554.       {
  1555.       int  i = 0;
  1556.   
  1557. !     while (search_ctx->ffsc_stopdirs_v[i] != NULL)
  1558.       {
  1559. !         vim_free(search_ctx->ffsc_stopdirs_v[i]);
  1560.           i++;
  1561.       }
  1562. !     vim_free(search_ctx->ffsc_stopdirs_v);
  1563.       }
  1564. !     search_ctx->ffsc_stopdirs_v = NULL;
  1565.   #endif
  1566.   
  1567.       /* reset everything */
  1568. !     search_ctx->ffsc_file_to_search = NULL;
  1569. !     search_ctx->ffsc_start_dir = NULL;
  1570. !     search_ctx->ffsc_fix_path = NULL;
  1571.   #ifdef FEAT_PATH_EXTRA
  1572. !     search_ctx->ffsc_wc_path = NULL;
  1573. !     search_ctx->ffsc_level = 0;
  1574.   #endif
  1575.   }
  1576.   
  1577. ***************
  1578. *** 5242,5248 ****
  1579.   
  1580.   #if defined(FEAT_SEARCHPATH) || defined(PROTO)
  1581.   /*
  1582. !  * Find the file name "ptr[len]" in the path.
  1583.    *
  1584.    * On the first call set the parameter 'first' to TRUE to initialize
  1585.    * the search.  For repeating calls to FALSE.
  1586. --- 5257,5263 ----
  1587.   
  1588.   #if defined(FEAT_SEARCHPATH) || defined(PROTO)
  1589.   /*
  1590. !  * Find the file name "ptr[len]" in the path.  Also finds directory names.
  1591.    *
  1592.    * On the first call set the parameter 'first' to TRUE to initialize
  1593.    * the search.  For repeating calls to FALSE.
  1594. ***************
  1595. *** 5276,5282 ****
  1596.   {
  1597.       return find_file_in_path_option(ptr, len, options, first,
  1598.           *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path,
  1599. !         FALSE, rel_fname, curbuf->b_p_sua);
  1600.   }
  1601.   
  1602.   static char_u    *ff_file_to_find = NULL;
  1603. --- 5291,5297 ----
  1604.   {
  1605.       return find_file_in_path_option(ptr, len, options, first,
  1606.           *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path,
  1607. !         FINDFILE_BOTH, rel_fname, curbuf->b_p_sua);
  1608.   }
  1609.   
  1610.   static char_u    *ff_file_to_find = NULL;
  1611. ***************
  1612. *** 5309,5325 ****
  1613.       char_u    *rel_fname;    /* file name searching relative to */
  1614.   {
  1615.       return find_file_in_path_option(ptr, len, options, TRUE, p_cdpath,
  1616. !                            TRUE, rel_fname, (char_u *)"");
  1617.   }
  1618.   
  1619.       char_u *
  1620. ! find_file_in_path_option(ptr, len, options, first, path_option, need_dir, rel_fname, suffixes)
  1621.       char_u    *ptr;        /* file name */
  1622.       int        len;        /* length of file name */
  1623.       int        options;
  1624.       int        first;        /* use count'th matching file name */
  1625.       char_u    *path_option;    /* p_path or p_cdpath */
  1626. !     int        need_dir;    /* looking for directory name */
  1627.       char_u    *rel_fname;    /* file name we are looking relative to. */
  1628.       char_u    *suffixes;    /* list of suffixes, 'suffixesadd' option */
  1629.   {
  1630. --- 5324,5340 ----
  1631.       char_u    *rel_fname;    /* file name searching relative to */
  1632.   {
  1633.       return find_file_in_path_option(ptr, len, options, TRUE, p_cdpath,
  1634. !                        FINDFILE_DIR, rel_fname, (char_u *)"");
  1635.   }
  1636.   
  1637.       char_u *
  1638. ! find_file_in_path_option(ptr, len, options, first, path_option, find_what, rel_fname, suffixes)
  1639.       char_u    *ptr;        /* file name */
  1640.       int        len;        /* length of file name */
  1641.       int        options;
  1642.       int        first;        /* use count'th matching file name */
  1643.       char_u    *path_option;    /* p_path or p_cdpath */
  1644. !     int        find_what;    /* FINDFILE_FILE, _DIR or _BOTH */
  1645.       char_u    *rel_fname;    /* file name we are looking relative to. */
  1646.       char_u    *suffixes;    /* list of suffixes, 'suffixesadd' option */
  1647.   {
  1648. ***************
  1649. *** 5421,5432 ****
  1650.   #ifdef DJGPP
  1651.                   /* "C:" by itself will fail for mch_getperm(),
  1652.                    * assume it's always valid. */
  1653. !                 (need_dir && NameBuff[0] != NUL
  1654.                     && NameBuff[1] == ':'
  1655.                     && NameBuff[2] == NUL) ||
  1656.   #endif
  1657.                   (mch_getperm(NameBuff) >= 0
  1658. !                        && (!need_dir || mch_isdir(NameBuff))))
  1659.               {
  1660.               file_name = vim_strsave(NameBuff);
  1661.               goto theend;
  1662. --- 5436,5449 ----
  1663.   #ifdef DJGPP
  1664.                   /* "C:" by itself will fail for mch_getperm(),
  1665.                    * assume it's always valid. */
  1666. !                 (find_what != FINDFILE_FILE && NameBuff[0] != NUL
  1667.                     && NameBuff[1] == ':'
  1668.                     && NameBuff[2] == NUL) ||
  1669.   #endif
  1670.                   (mch_getperm(NameBuff) >= 0
  1671. !                  && (find_what == FINDFILE_BOTH
  1672. !                  || ((find_what == FINDFILE_DIR)
  1673. !                             == mch_isdir(NameBuff)))))
  1674.               {
  1675.               file_name = vim_strsave(NameBuff);
  1676.               goto theend;
  1677. ***************
  1678. *** 5457,5465 ****
  1679.       {
  1680.           if (did_findfile_init)
  1681.           {
  1682. -         ff_search_ctx->ffsc_need_dir = need_dir;
  1683.           file_name = vim_findfile(fdip_search_ctx);
  1684. -         ff_search_ctx->ffsc_need_dir = FALSE;
  1685.           if (file_name != NULL)
  1686.               break;
  1687.   
  1688. --- 5474,5480 ----
  1689. ***************
  1690. *** 5492,5498 ****
  1691.           r_ptr = NULL;
  1692.   #endif
  1693.           fdip_search_ctx = vim_findfile_init(buf, ff_file_to_find,
  1694. !                         r_ptr, 100, FALSE, TRUE,
  1695.                          fdip_search_ctx, FALSE, rel_fname);
  1696.           if (fdip_search_ctx != NULL)
  1697.               did_findfile_init = TRUE;
  1698. --- 5507,5513 ----
  1699.           r_ptr = NULL;
  1700.   #endif
  1701.           fdip_search_ctx = vim_findfile_init(buf, ff_file_to_find,
  1702. !                         r_ptr, 100, FALSE, find_what,
  1703.                          fdip_search_ctx, FALSE, rel_fname);
  1704.           if (fdip_search_ctx != NULL)
  1705.               did_findfile_init = TRUE;
  1706. ***************
  1707. *** 5504,5510 ****
  1708.       {
  1709.       if (first == TRUE)
  1710.       {
  1711. !         if (need_dir)
  1712.           EMSG2(_("E344: Can't find directory \"%s\" in cdpath"),
  1713.               ff_file_to_find);
  1714.           else
  1715. --- 5519,5525 ----
  1716.       {
  1717.       if (first == TRUE)
  1718.       {
  1719. !         if (find_what == FINDFILE_DIR)
  1720.           EMSG2(_("E344: Can't find directory \"%s\" in cdpath"),
  1721.               ff_file_to_find);
  1722.           else
  1723. ***************
  1724. *** 5513,5519 ****
  1725.       }
  1726.       else
  1727.       {
  1728. !         if (need_dir)
  1729.           EMSG2(_("E346: No more directory \"%s\" found in cdpath"),
  1730.               ff_file_to_find);
  1731.           else
  1732. --- 5528,5534 ----
  1733.       }
  1734.       else
  1735.       {
  1736. !         if (find_what == FINDFILE_DIR)
  1737.           EMSG2(_("E346: No more directory \"%s\" found in cdpath"),
  1738.               ff_file_to_find);
  1739.           else
  1740. *** ../vim-7.1.255/src/vim.h    Sat Jan 19 15:55:51 2008
  1741. --- src/vim.h    Tue Jan 22 22:35:16 2008
  1742. ***************
  1743. *** 721,726 ****
  1744. --- 721,731 ----
  1745.   /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
  1746.    * is used when executing commands and EW_SILENT for interactive expanding. */
  1747.   
  1748. + /* Flags for find_file_*() functions. */
  1749. + #define FINDFILE_FILE    0    /* only files */
  1750. + #define FINDFILE_DIR    1    /* only directories */
  1751. + #define FINDFILE_BOTH    2    /* files and directories */
  1752.   #ifdef FEAT_VERTSPLIT
  1753.   # define W_WINCOL(wp)    (wp->w_wincol)
  1754.   # define W_WIDTH(wp)    (wp->w_width)
  1755. *** ../vim-7.1.255/src/tag.c    Sat Jan 19 15:55:51 2008
  1756. --- src/tag.c    Wed Feb 13 18:02:32 2008
  1757. ***************
  1758. *** 2669,2676 ****
  1759.   
  1760.           tnp->tn_search_ctx = vim_findfile_init(buf, filename,
  1761.               r_ptr, 100,
  1762. !             FALSE, /* don't free visited list */
  1763. !             FALSE, /* we search for a file */
  1764.               tnp->tn_search_ctx, TRUE, curbuf->b_ffname);
  1765.           if (tnp->tn_search_ctx != NULL)
  1766.           tnp->tn_did_filefind_init = TRUE;
  1767. --- 2669,2676 ----
  1768.   
  1769.           tnp->tn_search_ctx = vim_findfile_init(buf, filename,
  1770.               r_ptr, 100,
  1771. !             FALSE,         /* don't free visited list */
  1772. !             FINDFILE_FILE, /* we search for a file */
  1773.               tnp->tn_search_ctx, TRUE, curbuf->b_ffname);
  1774.           if (tnp->tn_search_ctx != NULL)
  1775.           tnp->tn_did_filefind_init = TRUE;
  1776. ***************
  1777. *** 2691,2696 ****
  1778. --- 2691,2697 ----
  1779.   {
  1780.       vim_free(tnp->tn_tags);
  1781.       vim_findfile_cleanup(tnp->tn_search_ctx);
  1782. +     tnp->tn_search_ctx = NULL;
  1783.       ga_clear_strings(&tag_fnames);
  1784.   }
  1785.   
  1786. *** ../vim-7.1.255/src/version.c    Wed Feb 20 11:27:59 2008
  1787. --- src/version.c    Wed Feb 20 12:09:54 2008
  1788. ***************
  1789. *** 668,669 ****
  1790. --- 668,671 ----
  1791.   {   /* Add new patch number below this line */
  1792. + /**/
  1793. +     256,
  1794.   /**/
  1795.  
  1796. -- 
  1797. hundred-and-one symptoms of being an internet addict:
  1798. 38. You wake up at 3 a.m. to go to the bathroom and stop and check your e-mail
  1799.     on the way back to bed.
  1800.  
  1801.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  1802. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  1803. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  1804.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  1805.