summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-08-25 18:12:06 +0100
committerBram Moolenaar <Bram@vim.org>2022-08-25 18:12:06 +0100
commit2bd9dbc19fc67395cfa1226dda7326071ab22464 (patch)
tree31448e8eb576d7580627724ad62b42e6b793dfc1 /src
parent520f6ef60a59f7b5f3da9199999d13dbe817d3ce (diff)
patch 9.0.0270: some values of 'path' and 'tags' invalid in the tiny versionv9.0.0270
Problem: Some values of 'path' and 'tags' do not work in the tiny version. Solution: Graduate the +path_extra feature.
Diffstat (limited to 'src')
-rw-r--r--src/errors.h2
-rw-r--r--src/evalfunc.c8
-rw-r--r--src/feature.h8
-rw-r--r--src/findfile.c113
-rw-r--r--src/tag.c4
-rw-r--r--src/version.c6
6 files changed, 16 insertions, 125 deletions
diff --git a/src/errors.h b/src/errors.h
index b903ae7d2c..9d987c9e39 100644
--- 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[]
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 6502b58b23..b3084f3358 100644
--- 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
diff --git a/src/feature.h b/src/feature.h
index 9c094e5aad..bffd80a919 100644
--- 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)
diff --git a/src/findfile.c b/src/findfile.c
index 8267be6e09..c3089274b2 100644
--- 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 *search_ctx, ff_stack_T *stack_ptr);
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_ptr)
{
// 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 path_len, char_u **stopdirs_v)
}
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);
diff --git a/src/tag.c b/src/tag.c
index 02f0818fec..3141e7686f 100644
--- 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);
diff --git a/src/version.c b/src/version.c
index b794c0c886..255725f22a 100644
--- 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,