summaryrefslogtreecommitdiff
blob: 720d3b25bb332aa9eb081b12d40f0ef4285d3a52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
To: vim-dev@vim.org
Subject: Patch 6.1.074
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 6.1.074
Problem:    When 'cdpath' includes "../..", changing to a directory in which
	    we currently already are doesn't work.  ff_check_visited() adds
	    the directory both when using it as the root for searching and for
	    the actual matches. (Stephen Rasku)
Solution:   Use a separate list for the already searched directories.
Files:	    src/misc2.c


*** ../vim61.073/src/misc2.c	Sun May  5 22:51:14 2002
--- src/misc2.c	Sun May  5 21:48:59 2002
***************
*** 3318,3324 ****
  
  /*
   * We might have to manage several visited lists during a search.
!  * This is expecially needed for * the tags option. If tags is set to:
   *      "./++/tags,./++/TAGS,++/tags"  (replace + with *)
   * So we have to do 3 searches:
   *   1) search from the current files directory downward for the file "tags"
--- 3318,3324 ----
  
  /*
   * We might have to manage several visited lists during a search.
!  * This is expecially needed for the tags option. If tags is set to:
   *      "./++/tags,./++/TAGS,++/tags"  (replace + with *)
   * So we have to do 3 searches:
   *   1) search from the current files directory downward for the file "tags"
***************
*** 3351,3357 ****
--- 3351,3359 ----
   * The search context:
   *   ffsc_stack_ptr:	the stack for the dirs to search
   *   ffsc_visited_list: the currently active visited list
+  *   ffsc_dir_visited_list: the currently active visited list for search dirs
   *   ffsc_visited_lists_list: the list of all visited lists
+  *   ffsc_dir_visited_lists_list: the list of all visited lists for search dirs
   *   ffsc_file_to_search:     the file to search for
   *   ffsc_start_dir:	the starting directory, if search path was relative
   *   ffsc_fix_path:	the fix part of the given path (without wildcards)
***************
*** 3365,3371 ****
--- 3367,3375 ----
  {
       ff_stack_T			*ffsc_stack_ptr;
       ff_visited_list_hdr_T	*ffsc_visited_list;
+      ff_visited_list_hdr_T	*ffsc_dir_visited_list;
       ff_visited_list_hdr_T	*ffsc_visited_lists_list;
+      ff_visited_list_hdr_T	*ffsc_dir_visited_lists_list;
       char_u			*ffsc_file_to_search;
       char_u			*ffsc_start_dir;
       char_u			*ffsc_fix_path;
***************
*** 3387,3394 ****
  #else
  static int ff_check_visited __ARGS((ff_visited_T **, char_u *));
  #endif
  static void ff_free_visited_list __ARGS((ff_visited_T *vl));
! static ff_visited_list_hdr_T* ff_get_visited_list __ARGS((char_u *));
  #ifdef FEAT_PATH_EXTRA
  static int ff_wc_equal __ARGS((char_u *s1, char_u *s2));
  #endif
--- 3391,3399 ----
  #else
  static int ff_check_visited __ARGS((ff_visited_T **, char_u *));
  #endif
+ static void vim_findfile_free_visited_list __ARGS((ff_visited_list_hdr_T **list_headp));
  static void ff_free_visited_list __ARGS((ff_visited_T *vl));
! static ff_visited_list_hdr_T* ff_get_visited_list __ARGS((char_u *, ff_visited_list_hdr_T **list_headp));
  #ifdef FEAT_PATH_EXTRA
  static int ff_wc_equal __ARGS((char_u *s1, char_u *s2));
  #endif
***************
*** 3541,3549 ****
  	 * filename. If no list for the current filename exists, creates a new
  	 * one.
  	 */
! 	ff_search_ctx->ffsc_visited_list = ff_get_visited_list(filename);
  	if (ff_search_ctx->ffsc_visited_list == NULL)
  	    goto error_return;
      }
  
      if (ff_expand_buffer == NULL)
--- 3546,3559 ----
  	 * filename. If no list for the current filename exists, creates a new
  	 * one.
  	 */
! 	ff_search_ctx->ffsc_visited_list = ff_get_visited_list(filename,
! 				     &ff_search_ctx->ffsc_visited_lists_list);
  	if (ff_search_ctx->ffsc_visited_list == NULL)
  	    goto error_return;
+ 	ff_search_ctx->ffsc_dir_visited_list = ff_get_visited_list(filename,
+ 				 &ff_search_ctx->ffsc_dir_visited_lists_list);
+ 	if (ff_search_ctx->ffsc_dir_visited_list == NULL)
+ 	    goto error_return;
      }
  
      if (ff_expand_buffer == NULL)
***************
*** 3915,3921 ****
  	     * first time (hence ctx->ff_filearray == NULL)
  	     */
  	    if (ctx->ffs_filearray == NULL
! 		    && ff_check_visited(&ff_search_ctx->ffsc_visited_list
  							  ->ffvl_visited_list,
  			ctx->ffs_fix_path
  #ifdef FEAT_PATH_EXTRA
--- 3925,3931 ----
  	     * first time (hence ctx->ff_filearray == NULL)
  	     */
  	    if (ctx->ffs_filearray == NULL
! 		    && ff_check_visited(&ff_search_ctx->ffsc_dir_visited_list
  							  ->ffvl_visited_list,
  			ctx->ffs_fix_path
  #ifdef FEAT_PATH_EXTRA
***************
*** 4282,4305 ****
  vim_findfile_free_visited(search_ctx)
      void	*search_ctx;
  {
!     ff_visited_list_hdr_T *vp;
! 
!     if (NULL == search_ctx)
  	return;
  
!     ff_search_ctx = (ff_search_ctx_T*)search_ctx;
  
!     while (NULL != ff_search_ctx->ffsc_visited_lists_list)
      {
! 	vp = ff_search_ctx->ffsc_visited_lists_list->ffvl_next;
! 	ff_free_visited_list(
! 		ff_search_ctx->ffsc_visited_lists_list->ffvl_visited_list);
! 
! 	vim_free(ff_search_ctx->ffsc_visited_lists_list->ffvl_filename);
! 	vim_free(ff_search_ctx->ffsc_visited_lists_list);
! 	ff_search_ctx->ffsc_visited_lists_list = vp;
      }
!     ff_search_ctx->ffsc_visited_lists_list = NULL;
  }
  
      static void
--- 4292,4322 ----
  vim_findfile_free_visited(search_ctx)
      void	*search_ctx;
  {
!     if (search_ctx == NULL)
  	return;
  
!     ff_search_ctx = (ff_search_ctx_T *)search_ctx;
! 
!     vim_findfile_free_visited_list(&ff_search_ctx->ffsc_visited_lists_list);
!     vim_findfile_free_visited_list(&ff_search_ctx->ffsc_dir_visited_lists_list);
! }
  
!     static void
! vim_findfile_free_visited_list(list_headp)
!     ff_visited_list_hdr_T	**list_headp;
! {
!     ff_visited_list_hdr_T *vp;
! 
!     while (*list_headp != NULL)
      {
! 	vp = (*list_headp)->ffvl_next;
! 	ff_free_visited_list((*list_headp)->ffvl_visited_list);
! 
! 	vim_free((*list_headp)->ffvl_filename);
! 	vim_free(*list_headp);
! 	*list_headp = vp;
      }
!     *list_headp = NULL;
  }
  
      static void
***************
*** 4322,4336 ****
   * allocates a new one.
   */
      static ff_visited_list_hdr_T*
! ff_get_visited_list(filename)
!     char_u	*filename;
  {
      ff_visited_list_hdr_T  *retptr = NULL;
  
      /* check if a visited list for the given filename exists */
!     if (ff_search_ctx->ffsc_visited_lists_list!= NULL)
      {
! 	retptr = ff_search_ctx->ffsc_visited_lists_list;
  	while (retptr != NULL)
  	{
  	    if (fnamecmp(filename, retptr->ffvl_filename) == 0)
--- 4339,4354 ----
   * allocates a new one.
   */
      static ff_visited_list_hdr_T*
! ff_get_visited_list(filename, list_headp)
!     char_u			*filename;
!     ff_visited_list_hdr_T	**list_headp;
  {
      ff_visited_list_hdr_T  *retptr = NULL;
  
      /* check if a visited list for the given filename exists */
!     if (*list_headp != NULL)
      {
! 	retptr = *list_headp;
  	while (retptr != NULL)
  	{
  	    if (fnamecmp(filename, retptr->ffvl_filename) == 0)
***************
*** 4380,4387 ****
  	vim_free(retptr);
  	return NULL;
      }
!     retptr->ffvl_next = ff_search_ctx->ffsc_visited_lists_list;
!     ff_search_ctx->ffsc_visited_lists_list = retptr;
  
      return retptr;
  }
--- 4398,4405 ----
  	vim_free(retptr);
  	return NULL;
      }
!     retptr->ffvl_next = *list_headp;
!     *list_headp = retptr;
  
      return retptr;
  }
*** ../vim61.073/src/version.c	Thu May 16 22:08:09 2002
--- src/version.c	Thu May 16 22:10:38 2002
***************
*** 608,609 ****
--- 608,611 ----
  {   /* Add new patch number below this line */
+ /**/
+     74,
  /**/

-- 
How To Keep A Healthy Level Of Insanity:
6. In the memo field of all your checks, write "for sexual favors".

 ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
///   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   \\\
\\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
 \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///