jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.564

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