Ticket #49809: 7.4.564.html

File 7.4.564.html, 6.9 KB (added by macports@…, 8 years ago)
Line 
1To: vim_dev@googlegroups.com
2Subject: Patch 7.4.564
3Fcc: outbox
4From: Bram Moolenaar <Bram@moolenaar.net>
5Mime-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8------------
9
10Patch 7.4.564
11Problem:    FEAT_OSFILETYPE is used even though it's never defined.
12Solution:   Remove the code. (Christian Brabandt)
13Files:      src/fileio.c
14
15
16*** ../vim-7.4.563/src/fileio.c 2014-11-19 16:38:01.516679915 +0100
17--- src/fileio.c        2015-01-07 14:40:04.731344734 +0100
18***************
19*** 10049,10105 ****
20  {
21      regmatch_T        regmatch;
22      int               result = FALSE;
23- #ifdef FEAT_OSFILETYPE
24-     int               no_pattern = FALSE; /* TRUE if check is filetype only */
25-     char_u    *type_start;
26-     char_u    c;
27-     int               match = FALSE;
28- #endif
29 
30      regmatch.rm_ic = p_fic; /* ignore case if 'fileignorecase' is set */
31! #ifdef FEAT_OSFILETYPE
32!     if (*pattern == '<')
33!     {
34!       /* There is a filetype condition specified with this pattern.
35!        * Check the filetype matches first. If not, don't bother with the
36!        * pattern (set regprog to NULL).
37!        * Always use magic for the regexp.
38!        */
39!
40!       for (type_start = pattern + 1; (c = *pattern); pattern++)
41!       {
42!           if ((c == ';' || c == '>') && match == FALSE)
43!           {
44!               *pattern = NUL;     /* Terminate the string */
45!               /* TODO: match with 'filetype' of buffer that "fname" comes
46!                * from. */
47!               match = mch_check_filetype(fname, type_start);
48!               *pattern = c;       /* Restore the terminator */
49!               type_start = pattern + 1;
50!           }
51!           if (c == '>')
52!               break;
53!       }
54!
55!       /* (c should never be NUL, but check anyway) */
56!       if (match == FALSE || c == NUL)
57!           regmatch.regprog = NULL;    /* Doesn't match - don't check pat. */
58!       else if (*pattern == NUL)
59!       {
60!           regmatch.regprog = NULL;    /* Vim will try to free regprog later */
61!           no_pattern = TRUE;  /* Always matches - don't check pat. */
62!       }
63!       else
64!           regmatch.regprog = vim_regcomp(pattern + 1, RE_MAGIC);
65!     }
66      else
67! #endif
68!     {
69!       if (prog != NULL)
70!           regmatch.regprog = *prog;
71!       else
72!           regmatch.regprog = vim_regcomp(pattern, RE_MAGIC);
73!     }
74 
75      /*
76       * Try for a match with the pattern with:
77--- 10049,10060 ----
78  {
79      regmatch_T        regmatch;
80      int               result = FALSE;
81 
82      regmatch.rm_ic = p_fic; /* ignore case if 'fileignorecase' is set */
83!     if (prog != NULL)
84!       regmatch.regprog = *prog;
85      else
86!       regmatch.regprog = vim_regcomp(pattern, RE_MAGIC);
87 
88      /*
89       * Try for a match with the pattern with:
90***************
91*** 10107,10125 ****
92       * 2. the short file name, when the pattern has a '/'.
93       * 3. the tail of the file name, when the pattern has no '/'.
94       */
95!     if (
96! #ifdef FEAT_OSFILETYPE
97!           /* If the check is for a filetype only and we don't care
98!            * about the path then skip all the regexp stuff.
99!            */
100!           no_pattern ||
101! #endif
102!           (regmatch.regprog != NULL
103             && ((allow_dirs
104                     && (vim_regexec(&regmatch, fname, (colnr_T)0)
105                         || (sfname != NULL
106                             && vim_regexec(&regmatch, sfname, (colnr_T)0))))
107!                || (!allow_dirs && vim_regexec(&regmatch, tail, (colnr_T)0)))))
108        result = TRUE;
109 
110      if (prog != NULL)
111--- 10062,10073 ----
112       * 2. the short file name, when the pattern has a '/'.
113       * 3. the tail of the file name, when the pattern has no '/'.
114       */
115!     if (regmatch.regprog != NULL
116             && ((allow_dirs
117                     && (vim_regexec(&regmatch, fname, (colnr_T)0)
118                         || (sfname != NULL
119                             && vim_regexec(&regmatch, sfname, (colnr_T)0))))
120!                || (!allow_dirs && vim_regexec(&regmatch, tail, (colnr_T)0))))
121        result = TRUE;
122 
123      if (prog != NULL)
124***************
125*** 10176,10184 ****
126   * allow_dirs, otherwise FALSE is put there -- webb.
127   * Handle backslashes before special characters, like "\*" and "\ ".
128   *
129-  * If FEAT_OSFILETYPE defined then pass initial <type> through unchanged. Eg:
130-  * '<html>myfile' becomes '<html>^myfile$' -- leonard.
131-  *
132   * Returns NULL when out of memory.
133   */
134      char_u *
135--- 10124,10129 ----
136***************
137*** 10188,10241 ****
138      char      *allow_dirs;    /* Result passed back out in here */
139      int               no_bslash UNUSED; /* Don't use a backward slash as pathsep */
140  {
141!     int               size;
142      char_u    *endp;
143      char_u    *reg_pat;
144      char_u    *p;
145      int               i;
146      int               nested = 0;
147      int               add_dollar = TRUE;
148- #ifdef FEAT_OSFILETYPE
149-     int               check_length = 0;
150- #endif
151 
152      if (allow_dirs != NULL)
153        *allow_dirs = FALSE;
154      if (pat_end == NULL)
155        pat_end = pat + STRLEN(pat);
156 
157- #ifdef FEAT_OSFILETYPE
158-     /* Find out how much of the string is the filetype check */
159-     if (*pat == '<')
160-     {
161-       /* Count chars until the next '>' */
162-       for (p = pat + 1; p < pat_end && *p != '>'; p++)
163-           ;
164-       if (p < pat_end)
165-       {
166-           /* Pattern is of the form <.*>.*  */
167-           check_length = p - pat + 1;
168-           if (p + 1 >= pat_end)
169-           {
170-               /* The 'pattern' is a filetype check ONLY */
171-               reg_pat = (char_u *)alloc(check_length + 1);
172-               if (reg_pat != NULL)
173-               {
174-                   mch_memmove(reg_pat, pat, (size_t)check_length);
175-                   reg_pat[check_length] = NUL;
176-               }
177-               return reg_pat;
178-           }
179-       }
180-       /* else: there was no closing '>' - assume it was a normal pattern */
181-
182-     }
183-     pat += check_length;
184-     size = 2 + check_length;
185- #else
186-     size = 2;         /* '^' at start, '$' at end */
187- #endif
188-
189      for (p = pat; p < pat_end; p++)
190      {
191        switch (*p)
192--- 10133,10151 ----
193      char      *allow_dirs;    /* Result passed back out in here */
194      int               no_bslash UNUSED; /* Don't use a backward slash as pathsep */
195  {
196!     int               size = 2; /* '^' at start, '$' at end */
197      char_u    *endp;
198      char_u    *reg_pat;
199      char_u    *p;
200      int               i;
201      int               nested = 0;
202      int               add_dollar = TRUE;
203 
204      if (allow_dirs != NULL)
205        *allow_dirs = FALSE;
206      if (pat_end == NULL)
207        pat_end = pat + STRLEN(pat);
208 
209      for (p = pat; p < pat_end; p++)
210      {
211        switch (*p)
212***************
213*** 10270,10283 ****
214      if (reg_pat == NULL)
215        return NULL;
216 
217- #ifdef FEAT_OSFILETYPE
218-     /* Copy the type check in to the start. */
219-     if (check_length)
220-       mch_memmove(reg_pat, pat - check_length, (size_t)check_length);
221-     i = check_length;
222- #else
223      i = 0;
224- #endif
225 
226      if (pat[0] == '*')
227        while (pat[0] == '*' && pat < pat_end - 1)
228--- 10180,10186 ----
229*** ../vim-7.4.563/src/version.c        2015-01-07 14:02:47.609220508 +0100
230--- src/version.c       2015-01-07 14:32:36.464539801 +0100
231***************
232*** 743,744 ****
233--- 743,746 ----
234  {   /* Add new patch number below this line */
235+ /**/
236+     564,
237  /**/
238
239-- 
240hundred-and-one symptoms of being an internet addict:
24155. You ask your doctor to implant a gig in your brain.
242
243 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
244///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
245\\\  an exciting new programming language -- http://www.Zimbu.org        ///
246 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///