]> git.pld-linux.org Git - packages/vim.git/blob - 6.2.076
- fix for current libselinux
[packages/vim.git] / 6.2.076
1 To: vim-dev@vim.org
2 Subject: Patch 6.2.076
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 6.2.076
11 Problem:    The tags listed for cscope are in the wrong order. (Johannes
12             Stezenbach)
13 Solution:   Remove the reordering of tags for the current file. (Sergey
14             Khorev)
15 Files:      src/if_cscope.c
16
17
18 *** ../vim-6.2.075/src/if_cscope.c      Thu Jul 24 21:50:11 2003
19 --- src/if_cscope.c     Wed Sep 10 21:35:19 2003
20 ***************
21 *** 1834,1841 ****
22       int               newsize = 0;
23       char      *ptag;
24       char      *fname, *lno, *extra, *tbuf;
25 !     int               i, j, idx, num;
26 !     char_u    *in_cur_file;
27       char      *globalcntx = "GLOBAL";
28       char      *cntxformat = " <<%s>>";
29       char      *context;
30 --- 1834,1840 ----
31       int               newsize = 0;
32       char      *ptag;
33       char      *fname, *lno, *extra, *tbuf;
34 !     int               i, idx, num;
35       char      *globalcntx = "GLOBAL";
36       char      *cntxformat = " <<%s>>";
37       char      *context;
38 ***************
39 *** 1865,2018 ****
40       msg_advance(msg_col + 2);
41       MSG_PUTS_ATTR(_("filename / context / line\n"), hl_attr(HLF_T));
42   
43 !     /*
44 !      * for normal tags (non-cscope tags), vim sorts the tags before printing.
45 !      * hence, the output from 'matches' needs to be sorted as well (but we're
46 !      * not actually sorting the contents of 'matches').  for sorting, we simply
47 !      * print all tags in the current file before any other tags.  this idea
48 !      * was suggested by Jeffrey George <jgeorge@texas.net>
49 !      */
50 !     in_cur_file = alloc_clear(num_matches);
51 !     if (in_cur_file != NULL)
52       {
53 !       if (curbuf->b_fname != NULL)
54         {
55 !           char *f;
56 !           int fname_len, ffname_len;
57   
58 !           fname_len = strlen((const char *)(curbuf->b_fname));
59 !           ffname_len = strlen((const char *)(curbuf->b_ffname));
60   
61 !           for (i = 0; i < num_matches; i++)
62 !           {
63 !               if ((f = strchr(matches[i], '\t')) != NULL)
64 !               {
65 !                   f++;
66 !                   if (strncmp((const char *)(curbuf->b_fname), f, fname_len)
67 !                                                                         == 0
68 !                           || strncmp((const char *)(curbuf->b_ffname), f,
69 !                                                            ffname_len) == 0)
70 !                       in_cur_file[i] = TRUE;
71 !               }
72 !           }
73 !       }
74 !     }
75   
76 !     /*
77 !      * if we were able to allocate 'in_cur_file', then we make two passes
78 !      * through 'matches'.  the first pass prints the tags in the current file,
79 !      * while the second prints all remaining tags.  if we were unable to
80 !      * allocate 'in_cur_file', we'll just make one pass through 'matches' and
81 !      * print them unsorted.
82 !      */
83 !     num = 1;
84 !     for (j = (in_cur_file) ? 2 : 1; j > 0; j--)
85 !     {
86 !       for (i = 0; i < num_matches; i++)
87         {
88 !           if (in_cur_file)
89 !           {
90 !               if (((j == 2) && (in_cur_file[i] == TRUE))
91 !                       || ((j == 1) && (in_cur_file[i] == FALSE)))
92 !                   idx = i;
93 !               else
94 !                   continue;
95 !           }
96             else
97 !               idx = i;
98   
99 !           /* if we really wanted to, we could avoid this malloc and strcpy
100 !            * by parsing matches[i] on the fly and placing stuff into buf
101 !            * directly, but that's too much of a hassle
102 !            */
103 !           if ((tbuf = (char *)alloc(strlen(matches[idx]) + 1)) == NULL)
104 !               continue;
105 !           (void)strcpy(tbuf, matches[idx]);
106
107 !           if ((fname = strtok(tbuf, (const char *)"\t")) == NULL)
108 !               continue;
109 !           if ((fname = strtok(NULL, (const char *)"\t")) == NULL)
110 !               continue;
111 !           if ((lno = strtok(NULL, (const char *)"\t")) == NULL)
112 !           {
113 !               /* if NULL, then no "extra", although in cscope's case, there
114 !                * should always be "extra".
115 !                */
116 !               extra = NULL;
117 !           }
118
119 !           extra = lno + strlen(lno) + 1;
120
121 !           lno[strlen(lno)-2] = '\0';  /* ignore ;" at the end */
122
123 !           /* hopefully 'num' (num of matches) will be less than 10^16 */
124 !           newsize = strlen(csfmt_str) + 16 + strlen(lno);
125 !           if (bufsize < newsize)
126 !           {
127 !               buf = (char *)vim_realloc(buf, newsize);
128 !               if (buf == NULL)
129 !                   bufsize = 0;
130 !               else
131 !                   bufsize = newsize;
132 !           }
133 !           if (buf != NULL)
134 !           {
135 !               /* csfmt_str = "%4d %6s  "; */
136 !               (void)sprintf(buf, csfmt_str, num, lno);
137 !               MSG_PUTS_ATTR(buf, hl_attr(HLF_CM));
138 !           }
139 !           MSG_PUTS_LONG_ATTR(cs_pathcomponents(fname), hl_attr(HLF_CM));
140
141 !           /* compute the required space for the context */
142 !           if (cntxts[idx] != NULL)
143 !               context = cntxts[idx];
144             else
145 !               context = globalcntx;
146 !           newsize = strlen(context) + strlen(cntxformat);
147   
148 !           if (bufsize < newsize)
149 !           {
150 !               buf = (char *)vim_realloc(buf, newsize);
151 !               if (buf == NULL)
152 !                   bufsize = 0;
153 !               else
154 !                   bufsize = newsize;
155 !           }
156 !           if (buf != NULL )
157 !           {
158 !               (void)sprintf(buf, cntxformat, context);
159
160 !               /* print the context only if it fits on the same line */
161 !               if (msg_col + (int)strlen(buf) >= (int)Columns)
162 !                   msg_putchar('\n');
163 !               msg_advance(12);
164 !               MSG_PUTS_LONG(buf);
165                 msg_putchar('\n');
166 !           }
167 !           if (extra != NULL)
168 !           {
169 !               msg_advance(13);
170 !               MSG_PUTS_LONG(extra);
171 !           }
172   
173 !           vim_free(tbuf); /* only after printing extra due to strtok use */
174   
175 !           if (msg_col)
176 !               msg_putchar('\n');
177   
178 !           ui_breakcheck();
179 !           if (got_int)
180 !           {
181 !               got_int = FALSE;        /* don't print any more matches */
182 !               j = 1;
183 !               break;
184 !           }
185
186 !           num++;
187 !       } /* for all matches */
188 !     } /* 1 or 2 passes through 'matches' */
189   
190 -     vim_free(in_cur_file);
191       vim_free(buf);
192   } /* cs_print_tags_priv */
193   
194 --- 1864,1963 ----
195       msg_advance(msg_col + 2);
196       MSG_PUTS_ATTR(_("filename / context / line\n"), hl_attr(HLF_T));
197   
198 !     num = 1;
199 !     for (i = 0; i < num_matches; i++)
200       {
201 !       idx = i;
202
203 !       /* if we really wanted to, we could avoid this malloc and strcpy
204 !        * by parsing matches[i] on the fly and placing stuff into buf
205 !        * directly, but that's too much of a hassle
206 !        */
207 !       if ((tbuf = (char *)alloc(strlen(matches[idx]) + 1)) == NULL)
208 !           continue;
209 !       (void)strcpy(tbuf, matches[idx]);
210
211 !       if ((fname = strtok(tbuf, (const char *)"\t")) == NULL)
212 !           continue;
213 !       if ((fname = strtok(NULL, (const char *)"\t")) == NULL)
214 !           continue;
215 !       if ((lno = strtok(NULL, (const char *)"\t")) == NULL)
216         {
217 !           /* if NULL, then no "extra", although in cscope's case, there
218 !            * should always be "extra".
219 !            */
220 !           extra = NULL;
221 !       }
222   
223 !       extra = lno + strlen(lno) + 1;
224   
225 !       lno[strlen(lno)-2] = '\0';  /* ignore ;" at the end */
226   
227 !       /* hopefully 'num' (num of matches) will be less than 10^16 */
228 !       newsize = strlen(csfmt_str) + 16 + strlen(lno);
229 !       if (bufsize < newsize)
230         {
231 !           buf = (char *)vim_realloc(buf, newsize);
232 !           if (buf == NULL)
233 !               bufsize = 0;
234             else
235 !               bufsize = newsize;
236 !       }
237 !       if (buf != NULL)
238 !       {
239 !           /* csfmt_str = "%4d %6s  "; */
240 !           (void)sprintf(buf, csfmt_str, num, lno);
241 !           MSG_PUTS_ATTR(buf, hl_attr(HLF_CM));
242 !       }
243 !       MSG_PUTS_LONG_ATTR(cs_pathcomponents(fname), hl_attr(HLF_CM));
244   
245 !       /* compute the required space for the context */
246 !       if (cntxts[idx] != NULL)
247 !           context = cntxts[idx];
248 !       else
249 !           context = globalcntx;
250 !       newsize = strlen(context) + strlen(cntxformat);
251
252 !       if (bufsize < newsize)
253 !       {
254 !           buf = (char *)vim_realloc(buf, newsize);
255 !           if (buf == NULL)
256 !               bufsize = 0;
257             else
258 !               bufsize = newsize;
259 !       }
260 !       if (buf != NULL)
261 !       {
262 !           (void)sprintf(buf, cntxformat, context);
263   
264 !           /* print the context only if it fits on the same line */
265 !           if (msg_col + (int)strlen(buf) >= (int)Columns)
266                 msg_putchar('\n');
267 !           msg_advance(12);
268 !           MSG_PUTS_LONG(buf);
269 !           msg_putchar('\n');
270 !       }
271 !       if (extra != NULL)
272 !       {
273 !           msg_advance(13);
274 !           MSG_PUTS_LONG(extra);
275 !       }
276   
277 !       vim_free(tbuf); /* only after printing extra due to strtok use */
278   
279 !       if (msg_col)
280 !           msg_putchar('\n');
281
282 !       ui_breakcheck();
283 !       if (got_int)
284 !       {
285 !           got_int = FALSE;    /* don't print any more matches */
286 !           break;
287 !       }
288   
289 !       num++;
290 !     } /* for all matches */
291   
292       vim_free(buf);
293   } /* cs_print_tags_priv */
294   
295 *** ../vim-6.2.075/src/version.c        Tue Sep  9 22:48:37 2003
296 --- src/version.c       Wed Sep 10 21:32:47 2003
297 ***************
298 *** 632,633 ****
299 --- 632,635 ----
300   {   /* Add new patch number below this line */
301 + /**/
302 +     76,
303   /**/
304
305 -- 
306 ARTHUR:          But if he was dying, he wouldn't bother to carve
307                  "Aaaaarrrrrrggghhh".  He'd just say it.
308 BROTHER MAYNARD: It's down there carved in stone.
309 GALAHAD:         Perhaps he was dictating.
310                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
311
312  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
313 ///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
314 \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
315  \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///
This page took 0.101558 seconds and 3 git commands to generate.