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