changeset 29863:62350f19d4ed v9.0.0270

patch 9.0.0270: some values of 'path' and 'tags' invalid in the tiny version Commit: https://github.com/vim/vim/commit/2bd9dbc19fc67395cfa1226dda7326071ab22464 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 25 18:12:06 2022 +0100 patch 9.0.0270: some values of 'path' and 'tags' invalid in the tiny version Problem: Some values of 'path' and 'tags' do not work in the tiny version. Solution: Graduate the +path_extra feature.
author Bram Moolenaar <Bram@vim.org>
date Thu, 25 Aug 2022 19:15:03 +0200
parents ae8c7b51bb54
children 34ff4f601c42
files runtime/doc/editing.txt runtime/doc/options.txt runtime/doc/various.txt src/errors.h src/evalfunc.c src/feature.h src/findfile.c src/tag.c src/version.c
diffstat 9 files changed, 19 insertions(+), 131 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/editing.txt
+++ b/runtime/doc/editing.txt
@@ -1703,8 +1703,6 @@ problem goes away the next day.
 ==============================================================================
 11. File Searching					*file-searching*
 
-{not available when compiled without the |+path_extra| feature}
-
 The file searching is currently used for the 'path', 'cdpath' and 'tags'
 options, for |finddir()| and |findfile()|.  Other commands use |wildcards|
 which is slightly different.
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -5949,7 +5949,6 @@ A jump table for the options with a shor
 	  "http://www.vim.org" will make ":find index.html" work.
 	- Search upwards and downwards in a directory tree using "*", "**" and
 	  ";".  See |file-searching| for info and syntax.
-	  {not available when compiled without the |+path_extra| feature}
 	- Careful with '\' characters, type two to get one in the option: >
 		:set path=.,c:\\include
 <	  Or just use '/' instead: >
@@ -8001,8 +8000,7 @@ A jump table for the options with a shor
 	a directory tree.  See |file-searching|.  E.g., "/lib/**/tags" will
 	find all files named "tags" below "/lib".  The filename itself cannot
 	contain wildcards, it is used as-is.  E.g., "/lib/**/tags?" will find
-	files called "tags?".  {not available when compiled without the
-	|+path_extra| feature}
+	files called "tags?".
 	The |tagfiles()| function can be used to get a list of the file names
 	actually used.
 	If Vim was compiled with the |+emacs_tags| feature, Emacs-style tag
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -432,7 +432,8 @@ T  *+num64*		64-bit Number support |Numb
 			check the actual size of a Number.
 m  *+ole*		Win32 GUI only: |ole-interface|
 N  *+packages*		Loading |packages|
-N  *+path_extra*	Up/downwards search in 'path' and 'tags'
+T  *+path_extra*	Up/downwards search in 'path' and 'tags'  Always
+			enabled since 9.0.0270
 m  *+perl*		Perl interface |perl|
 m  *+perl/dyn*		Perl interface |perl-dynamic| |/dyn|
 N  *+persistent_undo*	Persistent undo |undo-persistence|
--- a/src/errors.h
+++ b/src/errors.h
@@ -849,10 +849,8 @@ EXTERN char e_internal_error_lalloc_zero
 	INIT(= N_("E341: Internal error: lalloc(0, )"));
 EXTERN char e_out_of_memory_allocating_nr_bytes[]
 	INIT(= N_("E342: Out of memory!  (allocating %lu bytes)"));
-#ifdef FEAT_PATH_EXTRA
 EXTERN char e_invalid_path_number_must_be_at_end_of_path_or_be_followed_by_str[]
 	INIT(= N_("E343: Invalid path: '**[number]' must be at the end of the path or be followed by '%s'."));
-#endif
 EXTERN char e_cant_find_directory_str_in_cdpath[]
 	INIT(= N_("E344: Can't find directory \"%s\" in cdpath"));
 EXTERN char e_cant_find_file_str_in_path[]
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -5954,13 +5954,7 @@ f_has(typval_T *argvars, typval_T *rettv
 		0
 #endif
 		},
-	{"path_extra",
-#ifdef FEAT_PATH_EXTRA
-		1
-#else
-		0
-#endif
-		},
+	{"path_extra", 1},
 	{"perl",
 #if defined(FEAT_PERL) && !defined(DYNAMIC_PERL)
 		1
--- a/src/feature.h
+++ b/src/feature.h
@@ -117,6 +117,7 @@
  * +smartindent		smart C code indenting when the 'si' option is set.
  * +textobjects		Text objects: "vaw", "das", etc.
  * +file_in_path	"gf" and "<cfile>" commands.
+ * +path_extra		up/downwards searching in 'path' and 'tags'.
  *
  * Obsolete:
  * +tag_old_static	Old style static tags: "file:tag  file  ..".
@@ -211,13 +212,6 @@
 #endif
 
 /*
- * +path_extra		up/downwards searching in 'path' and 'tags'.
- */
-#ifdef FEAT_NORMAL
-# define FEAT_PATH_EXTRA
-#endif
-
-/*
  * +rightleft		Right-to-left editing/typing support.
  */
 #if defined(FEAT_BIG) && !defined(DISABLE_RIGHTLEFT)
--- a/src/findfile.c
+++ b/src/findfile.c
@@ -67,9 +67,7 @@ typedef struct ff_stack
     // the fix part (no wildcards) and the part containing the wildcards
     // of the search path
     char_u		*ffs_fix_path;
-#ifdef FEAT_PATH_EXTRA
     char_u		*ffs_wc_path;
-#endif
 
     // files/dirs found in the above directory, matched by the first wildcard
     // of wc_part
@@ -97,11 +95,10 @@ typedef struct ff_visited
 {
     struct ff_visited	*ffv_next;
 
-#ifdef FEAT_PATH_EXTRA
     // Visited directories are different if the wildcard string are
     // different. So we have to save it.
     char_u		*ffv_wc_path;
-#endif
+
     // for unix use inode etc for comparison (needed because of links), else
     // use filename.
 #ifdef UNIX
@@ -173,21 +170,15 @@ typedef struct ff_search_ctx_T
      char_u			*ffsc_file_to_search;
      char_u			*ffsc_start_dir;
      char_u			*ffsc_fix_path;
-#ifdef FEAT_PATH_EXTRA
      char_u			*ffsc_wc_path;
      int			ffsc_level;
      char_u			**ffsc_stopdirs_v;
-#endif
      int			ffsc_find_what;
      int			ffsc_tagfile;
 } ff_search_ctx_T;
 
 // locally needed functions
-#ifdef FEAT_PATH_EXTRA
 static int ff_check_visited(ff_visited_T **, char_u *, char_u *);
-#else
-static int ff_check_visited(ff_visited_T **, char_u *);
-#endif
 static void vim_findfile_free_visited(void *search_ctx_arg);
 static void vim_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp);
 static void ff_free_visited_list(ff_visited_T *vl);
@@ -197,14 +188,8 @@ static void ff_push(ff_search_ctx_T *sea
 static ff_stack_T *ff_pop(ff_search_ctx_T *search_ctx);
 static void ff_clear(ff_search_ctx_T *search_ctx);
 static void ff_free_stack_element(ff_stack_T *stack_ptr);
-#ifdef FEAT_PATH_EXTRA
 static ff_stack_T *ff_create_stack_element(char_u *, char_u *, int, int);
-#else
-static ff_stack_T *ff_create_stack_element(char_u *, int, int);
-#endif
-#ifdef FEAT_PATH_EXTRA
 static int ff_path_in_stoplist(char_u *, int, char_u **);
-#endif
 
 static char_u	*ff_expand_buffer = NULL; // used for expanding filenames
 
@@ -306,9 +291,7 @@ vim_findfile_init(
     int		tagfile,	// expanding names of tags files
     char_u	*rel_fname)	// file name to use for "."
 {
-#ifdef FEAT_PATH_EXTRA
     char_u		*wc_part;
-#endif
     ff_stack_T		*sptr;
     ff_search_ctx_T	*search_ctx;
 
@@ -409,7 +392,6 @@ vim_findfile_init(
 #endif
     }
 
-#ifdef FEAT_PATH_EXTRA
     /*
      * If stopdirs are given, split them into an array of pointers.
      * If this fails (mem allocation), there is no upward search at all or a
@@ -464,9 +446,7 @@ vim_findfile_init(
 	    search_ctx->ffsc_stopdirs_v[dircount-1] = NULL;
 	}
     }
-#endif
 
-#ifdef FEAT_PATH_EXTRA
     search_ctx->ffsc_level = level;
 
     /*
@@ -531,7 +511,6 @@ vim_findfile_init(
 	    goto error_return;
     }
     else
-#endif
 	search_ctx->ffsc_fix_path = vim_strsave(path);
 
     if (search_ctx->ffsc_start_dir == NULL)
@@ -565,7 +544,6 @@ vim_findfile_init(
 	    STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);
 	    add_pathsep(ff_expand_buffer);
 	}
-#ifdef FEAT_PATH_EXTRA
 	else
 	{
 	    char_u *p =  gettail(search_ctx->ffsc_fix_path);
@@ -612,15 +590,11 @@ vim_findfile_init(
 		search_ctx->ffsc_wc_path = temp;
 	    }
 	}
-#endif
 	vim_free(buf);
     }
 
     sptr = ff_create_stack_element(ff_expand_buffer,
-#ifdef FEAT_PATH_EXTRA
-	    search_ctx->ffsc_wc_path,
-#endif
-	    level, 0);
+					   search_ctx->ffsc_wc_path, level, 0);
 
     if (sptr == NULL)
 	goto error_return;
@@ -643,7 +617,6 @@ error_return:
     return NULL;
 }
 
-#if defined(FEAT_PATH_EXTRA) || defined(PROTO)
 /*
  * Get the stopdir string.  Check that ';' is not escaped.
  */
@@ -672,7 +645,6 @@ vim_findfile_stopdir(char_u *buf)
 	r_ptr = NULL;
     return r_ptr;
 }
-#endif
 
 /*
  * Clean up the given search context. Can handle a NULL pointer.
@@ -704,10 +676,8 @@ vim_findfile_cleanup(void *ctx)
 vim_findfile(void *search_ctx_arg)
 {
     char_u	*file_path;
-#ifdef FEAT_PATH_EXTRA
     char_u	*rest_of_wildcards;
     char_u	*path_end = NULL;
-#endif
     ff_stack_T	*stackp;
     int		len;
     int		i;
@@ -727,18 +697,14 @@ vim_findfile(void *search_ctx_arg)
     if ((file_path = alloc(MAXPATHL)) == NULL)
 	return NULL;
 
-#ifdef FEAT_PATH_EXTRA
     // store the end of the start dir -- needed for upward search
     if (search_ctx->ffsc_start_dir != NULL)
 	path_end = &search_ctx->ffsc_start_dir[
 					  STRLEN(search_ctx->ffsc_start_dir)];
-#endif
 
-#ifdef FEAT_PATH_EXTRA
     // upward search loop
     for (;;)
     {
-#endif
 	// downward search loop
 	for (;;)
 	{
@@ -774,11 +740,7 @@ vim_findfile(void *search_ctx_arg)
 	    if (stackp->ffs_filearray == NULL
 		    && ff_check_visited(&search_ctx->ffsc_dir_visited_list
 							  ->ffvl_visited_list,
-			stackp->ffs_fix_path
-#ifdef FEAT_PATH_EXTRA
-			, stackp->ffs_wc_path
-#endif
-			) == FAIL)
+			    stackp->ffs_fix_path, stackp->ffs_wc_path) == FAIL)
 	    {
 #ifdef FF_VERBOSE
 		if (p_verbose >= 5)
@@ -859,7 +821,6 @@ vim_findfile(void *search_ctx_arg)
 		    goto fail;
 		}
 
-#ifdef FEAT_PATH_EXTRA
 		rest_of_wildcards = stackp->ffs_wc_path;
 		if (*rest_of_wildcards != NUL)
 		{
@@ -919,7 +880,6 @@ vim_findfile(void *search_ctx_arg)
 		    if (vim_ispathsep(*rest_of_wildcards))
 			rest_of_wildcards++;
 		}
-#endif
 
 		/*
 		 * Expand wildcards like "*" and "$VAR".
@@ -947,18 +907,14 @@ vim_findfile(void *search_ctx_arg)
 		stackp->ffs_filearray_cur = 0;
 		stackp->ffs_stage = 0;
 	    }
-#ifdef FEAT_PATH_EXTRA
 	    else
 		rest_of_wildcards = &stackp->ffs_wc_path[
 						 STRLEN(stackp->ffs_wc_path)];
-#endif
 
 	    if (stackp->ffs_stage == 0)
 	    {
 		// this is the first time we work on this directory
-#ifdef FEAT_PATH_EXTRA
 		if (*rest_of_wildcards == NUL)
-#endif
 		{
 		    /*
 		     * We don't have further wildcards to expand, so we have to
@@ -1008,23 +964,17 @@ vim_findfile(void *search_ctx_arg)
 						   == mch_isdir(file_path)))))
 #ifndef FF_VERBOSE
 				    && (ff_check_visited(
-					    &search_ctx->ffsc_visited_list->ffvl_visited_list,
-					    file_path
-#ifdef FEAT_PATH_EXTRA
-					    , (char_u *)""
-#endif
-					    ) == OK)
+					    &search_ctx->ffsc_visited_list
+							   ->ffvl_visited_list,
+					    file_path, (char_u *)"") == OK)
 #endif
 			       )
 			    {
 #ifdef FF_VERBOSE
 				if (ff_check_visited(
-					    &search_ctx->ffsc_visited_list->ffvl_visited_list,
-					    file_path
-#ifdef FEAT_PATH_EXTRA
-					    , (char_u *)""
-#endif
-						    ) == FAIL)
+					    &search_ctx->ffsc_visited_list
+							   ->ffvl_visited_list,
+					      file_path, (char_u *)"") == FAIL)
 				{
 				    if (p_verbose >= 5)
 				    {
@@ -1074,7 +1024,6 @@ vim_findfile(void *search_ctx_arg)
 			}
 		    }
 		}
-#ifdef FEAT_PATH_EXTRA
 		else
 		{
 		    /*
@@ -1094,12 +1043,10 @@ vim_findfile(void *search_ctx_arg)
 						     stackp->ffs_level - 1, 0));
 		    }
 		}
-#endif
 		stackp->ffs_filearray_cur = 0;
 		stackp->ffs_stage = 1;
 	    }
 
-#ifdef FEAT_PATH_EXTRA
 	    /*
 	     * if wildcards contains '**' we have to descent till we reach the
 	     * leaves of the directory tree.
@@ -1119,14 +1066,12 @@ vim_findfile(void *search_ctx_arg)
 				stackp->ffs_wc_path, stackp->ffs_level - 1, 1));
 		}
 	    }
-#endif
 
 	    // we are done with the current directory
 	    ff_free_stack_element(stackp);
 
 	}
 
-#ifdef FEAT_PATH_EXTRA
 	// If we reached this, we didn't find anything downwards.
 	// Let's check if we should do an upward search.
 	if (search_ctx->ffsc_start_dir
@@ -1173,7 +1118,6 @@ vim_findfile(void *search_ctx_arg)
 	else
 	    break;
     }
-#endif
 
 fail:
     vim_free(file_path);
@@ -1222,9 +1166,7 @@ ff_free_visited_list(ff_visited_T *vl)
     while (vl != NULL)
     {
 	vp = vl->ffv_next;
-#ifdef FEAT_PATH_EXTRA
 	vim_free(vl->ffv_wc_path);
-#endif
 	vim_free(vl);
 	vl = vp;
     }
@@ -1298,7 +1240,6 @@ ff_get_visited_list(
     return retptr;
 }
 
-#ifdef FEAT_PATH_EXTRA
 /*
  * check if two wildcard paths are equal. Returns TRUE or FALSE.
  * They are equal if:
@@ -1339,7 +1280,6 @@ ff_wc_equal(char_u *s1, char_u *s2)
     }
     return s1[i] == s2[j];
 }
-#endif
 
 /*
  * maintains the list of already visited files and dirs
@@ -1353,11 +1293,8 @@ ff_wc_equal(char_u *s1, char_u *s2)
     static int
 ff_check_visited(
     ff_visited_T	**visited_list,
-    char_u		*fname
-#ifdef FEAT_PATH_EXTRA
-    , char_u		*wc_path
-#endif
-    )
+    char_u		*fname,
+    char_u		*wc_path)
 {
     ff_visited_T	*vp;
 #ifdef UNIX
@@ -1397,10 +1334,8 @@ ff_check_visited(
 		fnamecmp(vp->ffv_fname, ff_expand_buffer) == 0
 	   )
 	{
-#ifdef FEAT_PATH_EXTRA
 	    // are the wildcard parts equal
 	    if (ff_wc_equal(vp->ffv_wc_path, wc_path) == TRUE)
-#endif
 		// already visited
 		return FAIL;
 	}
@@ -1429,12 +1364,10 @@ ff_check_visited(
 #ifdef UNIX
 	}
 #endif
-#ifdef FEAT_PATH_EXTRA
 	if (wc_path != NULL)
 	    vp->ffv_wc_path = vim_strsave(wc_path);
 	else
 	    vp->ffv_wc_path = NULL;
-#endif
 
 	vp->ffv_next = *visited_list;
 	*visited_list = vp;
@@ -1449,9 +1382,7 @@ ff_check_visited(
     static ff_stack_T *
 ff_create_stack_element(
     char_u	*fix_part,
-#ifdef FEAT_PATH_EXTRA
     char_u	*wc_part,
-#endif
     int		level,
     int		star_star_empty)
 {
@@ -1474,17 +1405,11 @@ ff_create_stack_element(
 	fix_part = (char_u *)"";
     new->ffs_fix_path = vim_strsave(fix_part);
 
-#ifdef FEAT_PATH_EXTRA
     if (wc_part == NULL)
 	wc_part  = (char_u *)"";
     new->ffs_wc_path = vim_strsave(wc_part);
-#endif
 
-    if (new->ffs_fix_path == NULL
-#ifdef FEAT_PATH_EXTRA
-	    || new->ffs_wc_path == NULL
-#endif
-	    )
+    if (new->ffs_fix_path == NULL || new->ffs_wc_path == NULL)
     {
 	ff_free_stack_element(new);
 	new = NULL;
@@ -1532,9 +1457,7 @@ ff_free_stack_element(ff_stack_T *stack_
 {
     // vim_free handles possible NULL pointers
     vim_free(stack_ptr->ffs_fix_path);
-#ifdef FEAT_PATH_EXTRA
     vim_free(stack_ptr->ffs_wc_path);
-#endif
 
     if (stack_ptr->ffs_filearray != NULL)
 	FreeWild(stack_ptr->ffs_filearray_size, stack_ptr->ffs_filearray);
@@ -1557,11 +1480,8 @@ ff_clear(ff_search_ctx_T *search_ctx)
     vim_free(search_ctx->ffsc_file_to_search);
     vim_free(search_ctx->ffsc_start_dir);
     vim_free(search_ctx->ffsc_fix_path);
-#ifdef FEAT_PATH_EXTRA
     vim_free(search_ctx->ffsc_wc_path);
-#endif
 
-#ifdef FEAT_PATH_EXTRA
     if (search_ctx->ffsc_stopdirs_v != NULL)
     {
 	int  i = 0;
@@ -1574,19 +1494,15 @@ ff_clear(ff_search_ctx_T *search_ctx)
 	vim_free(search_ctx->ffsc_stopdirs_v);
     }
     search_ctx->ffsc_stopdirs_v = NULL;
-#endif
 
     // reset everything
     search_ctx->ffsc_file_to_search = NULL;
     search_ctx->ffsc_start_dir = NULL;
     search_ctx->ffsc_fix_path = NULL;
-#ifdef FEAT_PATH_EXTRA
     search_ctx->ffsc_wc_path = NULL;
     search_ctx->ffsc_level = 0;
-#endif
 }
 
-#ifdef FEAT_PATH_EXTRA
 /*
  * check if the given path is in the stopdirs
  * returns TRUE if yes else FALSE
@@ -1623,7 +1539,6 @@ ff_path_in_stoplist(char_u *path, int pa
     }
     return FALSE;
 }
-#endif
 
 /*
  * Find the file name "ptr[len]" in the path.  Also finds directory names.
@@ -1873,12 +1788,8 @@ find_file_in_path_option(
 		buf[0] = 0;
 		copy_option_part(&dir, buf, MAXPATHL, " ,");
 
-# ifdef FEAT_PATH_EXTRA
 		// get the stopdir string
 		r_ptr = vim_findfile_stopdir(buf);
-# else
-		r_ptr = NULL;
-# endif
 		fdip_search_ctx = vim_findfile_init(buf, ff_file_to_find,
 					    r_ptr, 100, FALSE, find_what,
 					   fdip_search_ctx, FALSE, rel_fname);
--- a/src/tag.c
+++ b/src/tag.c
@@ -3398,11 +3398,7 @@ get_tagfname(
 	    buf[0] = NUL;
 	    (void)copy_option_part(&tnp->tn_np, buf, MAXPATHL - 1, " ,");
 
-#ifdef FEAT_PATH_EXTRA
 	    r_ptr = vim_findfile_stopdir(buf);
-#else
-	    r_ptr = NULL;
-#endif
 	    // move the filename one char forward and truncate the
 	    // filepath with a NUL
 	    filename = gettail(buf);
--- a/src/version.c
+++ b/src/version.c
@@ -448,11 +448,7 @@ static char *(features[]) =
 #else
 	"-packages",
 #endif
-#ifdef FEAT_PATH_EXTRA
 	"+path_extra",
-#else
-	"-path_extra",
-#endif
 #ifdef FEAT_PERL
 # ifdef DYNAMIC_PERL
 	"+perl/dyn",
@@ -728,6 +724,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    270,
+/**/
     269,
 /**/
     268,