jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone
Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.4.564
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.564
Problem:    FEAT_OSFILETYPE is used even though it's never defined.
Solution:   Remove the code. (Christian Brabandt)
Files:	    src/fileio.c


*** ../vim-7.4.563/src/fileio.c	2014-11-19 16:38:01.516679915 +0100
--- src/fileio.c	2015-01-07 14:40:04.731344734 +0100
***************
*** 10049,10105 ****
  {
      regmatch_T	regmatch;
      int		result = FALSE;
- #ifdef FEAT_OSFILETYPE
-     int		no_pattern = FALSE; /* TRUE if check is filetype only */
-     char_u	*type_start;
-     char_u	c;
-     int		match = FALSE;
- #endif
  
      regmatch.rm_ic = p_fic; /* ignore case if 'fileignorecase' is set */
! #ifdef FEAT_OSFILETYPE
!     if (*pattern == '<')
!     {
! 	/* There is a filetype condition specified with this pattern.
! 	 * Check the filetype matches first. If not, don't bother with the
! 	 * pattern (set regprog to NULL).
! 	 * Always use magic for the regexp.
! 	 */
! 
! 	for (type_start = pattern + 1; (c = *pattern); pattern++)
! 	{
! 	    if ((c == ';' || c == '>') && match == FALSE)
! 	    {
! 		*pattern = NUL;	    /* Terminate the string */
! 		/* TODO: match with 'filetype' of buffer that "fname" comes
! 		 * from. */
! 		match = mch_check_filetype(fname, type_start);
! 		*pattern = c;	    /* Restore the terminator */
! 		type_start = pattern + 1;
! 	    }
! 	    if (c == '>')
! 		break;
! 	}
! 
! 	/* (c should never be NUL, but check anyway) */
! 	if (match == FALSE || c == NUL)
! 	    regmatch.regprog = NULL;	/* Doesn't match - don't check pat. */
! 	else if (*pattern == NUL)
! 	{
! 	    regmatch.regprog = NULL;	/* Vim will try to free regprog later */
! 	    no_pattern = TRUE;	/* Always matches - don't check pat. */
! 	}
! 	else
! 	    regmatch.regprog = vim_regcomp(pattern + 1, RE_MAGIC);
!     }
      else
! #endif
!     {
! 	if (prog != NULL)
! 	    regmatch.regprog = *prog;
! 	else
! 	    regmatch.regprog = vim_regcomp(pattern, RE_MAGIC);
!     }
  
      /*
       * Try for a match with the pattern with:
--- 10049,10060 ----
  {
      regmatch_T	regmatch;
      int		result = FALSE;
  
      regmatch.rm_ic = p_fic; /* ignore case if 'fileignorecase' is set */
!     if (prog != NULL)
! 	regmatch.regprog = *prog;
      else
! 	regmatch.regprog = vim_regcomp(pattern, RE_MAGIC);
  
      /*
       * Try for a match with the pattern with:
***************
*** 10107,10125 ****
       * 2. the short file name, when the pattern has a '/'.
       * 3. the tail of the file name, when the pattern has no '/'.
       */
!     if (
! #ifdef FEAT_OSFILETYPE
! 	    /* If the check is for a filetype only and we don't care
! 	     * about the path then skip all the regexp stuff.
! 	     */
! 	    no_pattern ||
! #endif
! 	    (regmatch.regprog != NULL
  	     && ((allow_dirs
  		     && (vim_regexec(&regmatch, fname, (colnr_T)0)
  			 || (sfname != NULL
  			     && vim_regexec(&regmatch, sfname, (colnr_T)0))))
! 		 || (!allow_dirs && vim_regexec(&regmatch, tail, (colnr_T)0)))))
  	result = TRUE;
  
      if (prog != NULL)
--- 10062,10073 ----
       * 2. the short file name, when the pattern has a '/'.
       * 3. the tail of the file name, when the pattern has no '/'.
       */
!     if (regmatch.regprog != NULL
  	     && ((allow_dirs
  		     && (vim_regexec(&regmatch, fname, (colnr_T)0)
  			 || (sfname != NULL
  			     && vim_regexec(&regmatch, sfname, (colnr_T)0))))
! 		 || (!allow_dirs && vim_regexec(&regmatch, tail, (colnr_T)0))))
  	result = TRUE;
  
      if (prog != NULL)
***************
*** 10176,10184 ****
   * allow_dirs, otherwise FALSE is put there -- webb.
   * Handle backslashes before special characters, like "\*" and "\ ".
   *
-  * If FEAT_OSFILETYPE defined then pass initial <type> through unchanged. Eg:
-  * '<html>myfile' becomes '<html>^myfile$' -- leonard.
-  *
   * Returns NULL when out of memory.
   */
      char_u *
--- 10124,10129 ----
***************
*** 10188,10241 ****
      char	*allow_dirs;	/* Result passed back out in here */
      int		no_bslash UNUSED; /* Don't use a backward slash as pathsep */
  {
!     int		size;
      char_u	*endp;
      char_u	*reg_pat;
      char_u	*p;
      int		i;
      int		nested = 0;
      int		add_dollar = TRUE;
- #ifdef FEAT_OSFILETYPE
-     int		check_length = 0;
- #endif
  
      if (allow_dirs != NULL)
  	*allow_dirs = FALSE;
      if (pat_end == NULL)
  	pat_end = pat + STRLEN(pat);
  
- #ifdef FEAT_OSFILETYPE
-     /* Find out how much of the string is the filetype check */
-     if (*pat == '<')
-     {
- 	/* Count chars until the next '>' */
- 	for (p = pat + 1; p < pat_end && *p != '>'; p++)
- 	    ;
- 	if (p < pat_end)
- 	{
- 	    /* Pattern is of the form <.*>.*  */
- 	    check_length = p - pat + 1;
- 	    if (p + 1 >= pat_end)
- 	    {
- 		/* The 'pattern' is a filetype check ONLY */
- 		reg_pat = (char_u *)alloc(check_length + 1);
- 		if (reg_pat != NULL)
- 		{
- 		    mch_memmove(reg_pat, pat, (size_t)check_length);
- 		    reg_pat[check_length] = NUL;
- 		}
- 		return reg_pat;
- 	    }
- 	}
- 	/* else: there was no closing '>' - assume it was a normal pattern */
- 
-     }
-     pat += check_length;
-     size = 2 + check_length;
- #else
-     size = 2;		/* '^' at start, '$' at end */
- #endif
- 
      for (p = pat; p < pat_end; p++)
      {
  	switch (*p)
--- 10133,10151 ----
      char	*allow_dirs;	/* Result passed back out in here */
      int		no_bslash UNUSED; /* Don't use a backward slash as pathsep */
  {
!     int		size = 2; /* '^' at start, '$' at end */
      char_u	*endp;
      char_u	*reg_pat;
      char_u	*p;
      int		i;
      int		nested = 0;
      int		add_dollar = TRUE;
  
      if (allow_dirs != NULL)
  	*allow_dirs = FALSE;
      if (pat_end == NULL)
  	pat_end = pat + STRLEN(pat);
  
      for (p = pat; p < pat_end; p++)
      {
  	switch (*p)
***************
*** 10270,10283 ****
      if (reg_pat == NULL)
  	return NULL;
  
- #ifdef FEAT_OSFILETYPE
-     /* Copy the type check in to the start. */
-     if (check_length)
- 	mch_memmove(reg_pat, pat - check_length, (size_t)check_length);
-     i = check_length;
- #else
      i = 0;
- #endif
  
      if (pat[0] == '*')
  	while (pat[0] == '*' && pat < pat_end - 1)
--- 10180,10186 ----
*** ../vim-7.4.563/src/version.c	2015-01-07 14:02:47.609220508 +0100
--- src/version.c	2015-01-07 14:32:36.464539801 +0100
***************
*** 743,744 ****
--- 743,746 ----
  {   /* Add new patch number below this line */
+ /**/
+     564,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
55. You ask your doctor to implant a gig in your brain.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///