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