|
|
22c937 |
To: vim_dev@googlegroups.com
|
|
|
22c937 |
Subject: Patch 7.4.564
|
|
|
22c937 |
Fcc: outbox
|
|
|
22c937 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
22c937 |
Mime-Version: 1.0
|
|
|
22c937 |
Content-Type: text/plain; charset=UTF-8
|
|
|
22c937 |
Content-Transfer-Encoding: 8bit
|
|
|
22c937 |
------------
|
|
|
22c937 |
|
|
|
22c937 |
Patch 7.4.564
|
|
|
22c937 |
Problem: FEAT_OSFILETYPE is used even though it's never defined.
|
|
|
22c937 |
Solution: Remove the code. (Christian Brabandt)
|
|
|
22c937 |
Files: src/fileio.c
|
|
|
22c937 |
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.563/src/fileio.c 2014-11-19 16:38:01.516679915 +0100
|
|
|
22c937 |
--- src/fileio.c 2015-01-07 14:40:04.731344734 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 10049,10105 ****
|
|
|
22c937 |
{
|
|
|
22c937 |
regmatch_T regmatch;
|
|
|
22c937 |
int result = FALSE;
|
|
|
22c937 |
- #ifdef FEAT_OSFILETYPE
|
|
|
22c937 |
- int no_pattern = FALSE; /* TRUE if check is filetype only */
|
|
|
22c937 |
- char_u *type_start;
|
|
|
22c937 |
- char_u c;
|
|
|
22c937 |
- int match = FALSE;
|
|
|
22c937 |
- #endif
|
|
|
22c937 |
|
|
|
22c937 |
regmatch.rm_ic = p_fic; /* ignore case if 'fileignorecase' is set */
|
|
|
22c937 |
! #ifdef FEAT_OSFILETYPE
|
|
|
22c937 |
! if (*pattern == '<')
|
|
|
22c937 |
! {
|
|
|
22c937 |
! /* There is a filetype condition specified with this pattern.
|
|
|
22c937 |
! * Check the filetype matches first. If not, don't bother with the
|
|
|
22c937 |
! * pattern (set regprog to NULL).
|
|
|
22c937 |
! * Always use magic for the regexp.
|
|
|
22c937 |
! */
|
|
|
22c937 |
!
|
|
|
22c937 |
! for (type_start = pattern + 1; (c = *pattern); pattern++)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! if ((c == ';' || c == '>') && match == FALSE)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! *pattern = NUL; /* Terminate the string */
|
|
|
22c937 |
! /* TODO: match with 'filetype' of buffer that "fname" comes
|
|
|
22c937 |
! * from. */
|
|
|
22c937 |
! match = mch_check_filetype(fname, type_start);
|
|
|
22c937 |
! *pattern = c; /* Restore the terminator */
|
|
|
22c937 |
! type_start = pattern + 1;
|
|
|
22c937 |
! }
|
|
|
22c937 |
! if (c == '>')
|
|
|
22c937 |
! break;
|
|
|
22c937 |
! }
|
|
|
22c937 |
!
|
|
|
22c937 |
! /* (c should never be NUL, but check anyway) */
|
|
|
22c937 |
! if (match == FALSE || c == NUL)
|
|
|
22c937 |
! regmatch.regprog = NULL; /* Doesn't match - don't check pat. */
|
|
|
22c937 |
! else if (*pattern == NUL)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! regmatch.regprog = NULL; /* Vim will try to free regprog later */
|
|
|
22c937 |
! no_pattern = TRUE; /* Always matches - don't check pat. */
|
|
|
22c937 |
! }
|
|
|
22c937 |
! else
|
|
|
22c937 |
! regmatch.regprog = vim_regcomp(pattern + 1, RE_MAGIC);
|
|
|
22c937 |
! }
|
|
|
22c937 |
else
|
|
|
22c937 |
! #endif
|
|
|
22c937 |
! {
|
|
|
22c937 |
! if (prog != NULL)
|
|
|
22c937 |
! regmatch.regprog = *prog;
|
|
|
22c937 |
! else
|
|
|
22c937 |
! regmatch.regprog = vim_regcomp(pattern, RE_MAGIC);
|
|
|
22c937 |
! }
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
* Try for a match with the pattern with:
|
|
|
22c937 |
--- 10049,10060 ----
|
|
|
22c937 |
{
|
|
|
22c937 |
regmatch_T regmatch;
|
|
|
22c937 |
int result = FALSE;
|
|
|
22c937 |
|
|
|
22c937 |
regmatch.rm_ic = p_fic; /* ignore case if 'fileignorecase' is set */
|
|
|
22c937 |
! if (prog != NULL)
|
|
|
22c937 |
! regmatch.regprog = *prog;
|
|
|
22c937 |
else
|
|
|
22c937 |
! regmatch.regprog = vim_regcomp(pattern, RE_MAGIC);
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
* Try for a match with the pattern with:
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 10107,10125 ****
|
|
|
22c937 |
* 2. the short file name, when the pattern has a '/'.
|
|
|
22c937 |
* 3. the tail of the file name, when the pattern has no '/'.
|
|
|
22c937 |
*/
|
|
|
22c937 |
! if (
|
|
|
22c937 |
! #ifdef FEAT_OSFILETYPE
|
|
|
22c937 |
! /* If the check is for a filetype only and we don't care
|
|
|
22c937 |
! * about the path then skip all the regexp stuff.
|
|
|
22c937 |
! */
|
|
|
22c937 |
! no_pattern ||
|
|
|
22c937 |
! #endif
|
|
|
22c937 |
! (regmatch.regprog != NULL
|
|
|
22c937 |
&& ((allow_dirs
|
|
|
22c937 |
&& (vim_regexec(®match, fname, (colnr_T)0)
|
|
|
22c937 |
|| (sfname != NULL
|
|
|
22c937 |
&& vim_regexec(®match, sfname, (colnr_T)0))))
|
|
|
22c937 |
! || (!allow_dirs && vim_regexec(®match, tail, (colnr_T)0)))))
|
|
|
22c937 |
result = TRUE;
|
|
|
22c937 |
|
|
|
22c937 |
if (prog != NULL)
|
|
|
22c937 |
--- 10062,10073 ----
|
|
|
22c937 |
* 2. the short file name, when the pattern has a '/'.
|
|
|
22c937 |
* 3. the tail of the file name, when the pattern has no '/'.
|
|
|
22c937 |
*/
|
|
|
22c937 |
! if (regmatch.regprog != NULL
|
|
|
22c937 |
&& ((allow_dirs
|
|
|
22c937 |
&& (vim_regexec(®match, fname, (colnr_T)0)
|
|
|
22c937 |
|| (sfname != NULL
|
|
|
22c937 |
&& vim_regexec(®match, sfname, (colnr_T)0))))
|
|
|
22c937 |
! || (!allow_dirs && vim_regexec(®match, tail, (colnr_T)0))))
|
|
|
22c937 |
result = TRUE;
|
|
|
22c937 |
|
|
|
22c937 |
if (prog != NULL)
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 10176,10184 ****
|
|
|
22c937 |
* allow_dirs, otherwise FALSE is put there -- webb.
|
|
|
22c937 |
* Handle backslashes before special characters, like "\*" and "\ ".
|
|
|
22c937 |
*
|
|
|
22c937 |
- * If FEAT_OSFILETYPE defined then pass initial <type> through unchanged. Eg:
|
|
|
22c937 |
- * '<html>myfile' becomes '<html>^myfile$' -- leonard.
|
|
|
22c937 |
- *
|
|
|
22c937 |
* Returns NULL when out of memory.
|
|
|
22c937 |
*/
|
|
|
22c937 |
char_u *
|
|
|
22c937 |
--- 10124,10129 ----
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 10188,10241 ****
|
|
|
22c937 |
char *allow_dirs; /* Result passed back out in here */
|
|
|
22c937 |
int no_bslash UNUSED; /* Don't use a backward slash as pathsep */
|
|
|
22c937 |
{
|
|
|
22c937 |
! int size;
|
|
|
22c937 |
char_u *endp;
|
|
|
22c937 |
char_u *reg_pat;
|
|
|
22c937 |
char_u *p;
|
|
|
22c937 |
int i;
|
|
|
22c937 |
int nested = 0;
|
|
|
22c937 |
int add_dollar = TRUE;
|
|
|
22c937 |
- #ifdef FEAT_OSFILETYPE
|
|
|
22c937 |
- int check_length = 0;
|
|
|
22c937 |
- #endif
|
|
|
22c937 |
|
|
|
22c937 |
if (allow_dirs != NULL)
|
|
|
22c937 |
*allow_dirs = FALSE;
|
|
|
22c937 |
if (pat_end == NULL)
|
|
|
22c937 |
pat_end = pat + STRLEN(pat);
|
|
|
22c937 |
|
|
|
22c937 |
- #ifdef FEAT_OSFILETYPE
|
|
|
22c937 |
- /* Find out how much of the string is the filetype check */
|
|
|
22c937 |
- if (*pat == '<')
|
|
|
22c937 |
- {
|
|
|
22c937 |
- /* Count chars until the next '>' */
|
|
|
22c937 |
- for (p = pat + 1; p < pat_end && *p != '>'; p++)
|
|
|
22c937 |
- ;
|
|
|
22c937 |
- if (p < pat_end)
|
|
|
22c937 |
- {
|
|
|
22c937 |
- /* Pattern is of the form <.*>.* */
|
|
|
22c937 |
- check_length = p - pat + 1;
|
|
|
22c937 |
- if (p + 1 >= pat_end)
|
|
|
22c937 |
- {
|
|
|
22c937 |
- /* The 'pattern' is a filetype check ONLY */
|
|
|
22c937 |
- reg_pat = (char_u *)alloc(check_length + 1);
|
|
|
22c937 |
- if (reg_pat != NULL)
|
|
|
22c937 |
- {
|
|
|
22c937 |
- mch_memmove(reg_pat, pat, (size_t)check_length);
|
|
|
22c937 |
- reg_pat[check_length] = NUL;
|
|
|
22c937 |
- }
|
|
|
22c937 |
- return reg_pat;
|
|
|
22c937 |
- }
|
|
|
22c937 |
- }
|
|
|
22c937 |
- /* else: there was no closing '>' - assume it was a normal pattern */
|
|
|
22c937 |
-
|
|
|
22c937 |
- }
|
|
|
22c937 |
- pat += check_length;
|
|
|
22c937 |
- size = 2 + check_length;
|
|
|
22c937 |
- #else
|
|
|
22c937 |
- size = 2; /* '^' at start, '$' at end */
|
|
|
22c937 |
- #endif
|
|
|
22c937 |
-
|
|
|
22c937 |
for (p = pat; p < pat_end; p++)
|
|
|
22c937 |
{
|
|
|
22c937 |
switch (*p)
|
|
|
22c937 |
--- 10133,10151 ----
|
|
|
22c937 |
char *allow_dirs; /* Result passed back out in here */
|
|
|
22c937 |
int no_bslash UNUSED; /* Don't use a backward slash as pathsep */
|
|
|
22c937 |
{
|
|
|
22c937 |
! int size = 2; /* '^' at start, '$' at end */
|
|
|
22c937 |
char_u *endp;
|
|
|
22c937 |
char_u *reg_pat;
|
|
|
22c937 |
char_u *p;
|
|
|
22c937 |
int i;
|
|
|
22c937 |
int nested = 0;
|
|
|
22c937 |
int add_dollar = TRUE;
|
|
|
22c937 |
|
|
|
22c937 |
if (allow_dirs != NULL)
|
|
|
22c937 |
*allow_dirs = FALSE;
|
|
|
22c937 |
if (pat_end == NULL)
|
|
|
22c937 |
pat_end = pat + STRLEN(pat);
|
|
|
22c937 |
|
|
|
22c937 |
for (p = pat; p < pat_end; p++)
|
|
|
22c937 |
{
|
|
|
22c937 |
switch (*p)
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 10270,10283 ****
|
|
|
22c937 |
if (reg_pat == NULL)
|
|
|
22c937 |
return NULL;
|
|
|
22c937 |
|
|
|
22c937 |
- #ifdef FEAT_OSFILETYPE
|
|
|
22c937 |
- /* Copy the type check in to the start. */
|
|
|
22c937 |
- if (check_length)
|
|
|
22c937 |
- mch_memmove(reg_pat, pat - check_length, (size_t)check_length);
|
|
|
22c937 |
- i = check_length;
|
|
|
22c937 |
- #else
|
|
|
22c937 |
i = 0;
|
|
|
22c937 |
- #endif
|
|
|
22c937 |
|
|
|
22c937 |
if (pat[0] == '*')
|
|
|
22c937 |
while (pat[0] == '*' && pat < pat_end - 1)
|
|
|
22c937 |
--- 10180,10186 ----
|
|
|
22c937 |
*** ../vim-7.4.563/src/version.c 2015-01-07 14:02:47.609220508 +0100
|
|
|
22c937 |
--- src/version.c 2015-01-07 14:32:36.464539801 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 743,744 ****
|
|
|
22c937 |
--- 743,746 ----
|
|
|
22c937 |
{ /* Add new patch number below this line */
|
|
|
22c937 |
+ /**/
|
|
|
22c937 |
+ 564,
|
|
|
22c937 |
/**/
|
|
|
22c937 |
|
|
|
22c937 |
--
|
|
|
22c937 |
hundred-and-one symptoms of being an internet addict:
|
|
|
22c937 |
55. You ask your doctor to implant a gig in your brain.
|
|
|
22c937 |
|
|
|
22c937 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
22c937 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
22c937 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
22c937 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|