summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-03-04 18:08:14 +0100
committerBram Moolenaar <Bram@vim.org>2018-03-04 18:08:14 +0100
commitf2bd8ef2b4507d02c6043affff8f7e85e3414d5f (patch)
treef14cb8e7ff09975920f3a813d7de4851a2972661 /src/search.c
parent3f54fd319f6641b4bed478bcc90cdb39ede68e31 (diff)
downloadvim-git-f2bd8ef2b4507d02c6043affff8f7e85e3414d5f.tar.gz
patch 8.0.1564: too many #ifdefsv8.0.1564
Problem: Too many #ifdefs. Solution: Graduate the +autocmd feature. Takes away 450 #ifdefs and increases code size of tiny Vim by only 40 Kbyte.
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/search.c b/src/search.c
index d3c651829..a4b272224 100644
--- a/src/search.c
+++ b/src/search.c
@@ -97,10 +97,8 @@ static char_u lastc_bytes[MB_MAXBYTES + 1];
static int lastc_bytelen = 1; /* >1 for multi-byte char */
#endif
-#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
/* copy of spats[], for keeping the search patterns while executing autocmds */
static struct spat saved_spats[2];
-#endif
# ifdef FEAT_SEARCH_EXTRA
/* copy of spats[RE_SEARCH], for keeping the search patterns while incremental
* searching */
@@ -300,7 +298,6 @@ save_re_pat(int idx, char_u *pat, int magic)
}
}
-#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
/*
* Save the search patterns, so they can be restored later.
* Used before/after executing autocommands and user functions.
@@ -318,10 +315,10 @@ save_search_patterns(void)
saved_spats[1] = spats[1];
if (spats[1].pat != NULL)
saved_spats[1].pat = vim_strsave(spats[1].pat);
+#ifdef FEAT_SEARCH_EXTRA
saved_last_idx = last_idx;
-# ifdef FEAT_SEARCH_EXTRA
saved_no_hlsearch = no_hlsearch;
-# endif
+#endif
}
}
@@ -332,18 +329,17 @@ restore_search_patterns(void)
{
vim_free(spats[0].pat);
spats[0] = saved_spats[0];
-# if defined(FEAT_EVAL)
+#if defined(FEAT_EVAL)
set_vv_searchforward();
-# endif
+#endif
vim_free(spats[1].pat);
spats[1] = saved_spats[1];
+#ifdef FEAT_SEARCH_EXTRA
last_idx = saved_last_idx;
-# ifdef FEAT_SEARCH_EXTRA
SET_NO_HLSEARCH(saved_no_hlsearch);
-# endif
+#endif
}
}
-#endif
#if defined(EXITFREE) || defined(PROTO)
void