diff src/viminfo.c @ 26532:255bc9a08e58 v8.2.3795

patch 8.2.3795: too many #ifdefs Commit: https://github.com/vim/vim/commit/739f13a55b4982efb37ebc9282e7f79975fff982 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 13 13:12:53 2021 +0000 patch 8.2.3795: too many #ifdefs Problem: Too many #ifdefs. Solution: Graduate the jumplist feature.
author Bram Moolenaar <Bram@vim.org>
date Mon, 13 Dec 2021 14:15:03 +0100
parents 50f8204eb8f7
children 3a2b222107a6
line wrap: on
line diff
--- a/src/viminfo.c
+++ b/src/viminfo.c
@@ -1947,10 +1947,8 @@ write_viminfo_registers(FILE *fp)
  */
 
 static xfmark_T *vi_namedfm = NULL;
-#ifdef FEAT_JUMPLIST
 static xfmark_T *vi_jumplist = NULL;
 static int vi_jumplist_len = 0;
-#endif
 
     static void
 write_one_mark(FILE *fp_out, int c, pos_T *pos)
@@ -1978,7 +1976,6 @@ write_buffer_marks(buf_T *buf, FILE *fp_
     write_one_mark(fp_out, '"', &buf->b_last_cursor);
     write_one_mark(fp_out, '^', &buf->b_last_insert);
     write_one_mark(fp_out, '.', &buf->b_last_change);
-#ifdef FEAT_JUMPLIST
     // changelist positions are stored oldest first
     for (i = 0; i < buf->b_changelistlen; ++i)
     {
@@ -1987,7 +1984,6 @@ write_buffer_marks(buf_T *buf, FILE *fp_
 							 buf->b_changelist[i]))
 	    write_one_mark(fp_out, '+', &buf->b_changelist[i]);
     }
-#endif
     for (i = 0; i < NMARKS; i++)
 	write_one_mark(fp_out, 'a' + i, &buf->b_namedm[i]);
 }
@@ -2173,7 +2169,6 @@ write_viminfo_filemarks(FILE *fp)
 	write_one_filemark(fp, fm, '\'', i - NMARKS + '0');
     }
 
-#ifdef FEAT_JUMPLIST
     // Write the jumplist with -'
     fputs(_("\n# Jumplist (newest first):\n"), fp);
     setpcmark();	// add current cursor position
@@ -2201,7 +2196,6 @@ write_viminfo_filemarks(FILE *fp)
 		    && !skip_for_viminfo(buf)))
 	    write_one_filemark(fp, fm, '-', '\'');
     }
-#endif
 }
 
 /*
@@ -2412,7 +2406,6 @@ copy_viminfo_marks(
 			case '^': curbuf->b_last_insert = pos; break;
 			case '.': curbuf->b_last_change = pos; break;
 			case '+':
-#ifdef FEAT_JUMPLIST
 				  // changelist positions are stored oldest
 				  // first
 				  if (curbuf->b_changelistlen == JUMPLISTSIZE)
@@ -2424,7 +2417,6 @@ copy_viminfo_marks(
 				      ++curbuf->b_changelistlen;
 				  curbuf->b_changelist[
 					   curbuf->b_changelistlen - 1] = pos;
-#endif
 				  break;
 
 				  // Using the line number for the last-used
@@ -2442,7 +2434,6 @@ copy_viminfo_marks(
 
 	if (load_marks)
 	{
-#ifdef FEAT_JUMPLIST
 	    win_T	*wp;
 
 	    FOR_ALL_WINDOWS(wp)
@@ -2450,7 +2441,6 @@ copy_viminfo_marks(
 		if (wp->w_buffer == curbuf)
 		    wp->w_changelistidx = curbuf->b_changelistlen;
 	    }
-#endif
 	    if (flags & VIF_ONLY_CURBUF)
 		break;
 	}
@@ -2504,7 +2494,6 @@ read_viminfo_filemark(vir_T *virp, int f
     {
 	if (*str == '\'')
 	{
-#ifdef FEAT_JUMPLIST
 	    // If the jumplist isn't full insert fmark as oldest entry
 	    if (curwin->w_jumplistlen == JUMPLISTSIZE)
 		fm = NULL;
@@ -2518,9 +2507,6 @@ read_viminfo_filemark(vir_T *virp, int f
 		fm->fmark.mark.lnum = 0;
 		fm->fname = NULL;
 	    }
-#else
-	    fm = NULL;
-#endif
 	}
 	else if (VIM_ISDIGIT(*str))
 	    fm = &namedfm_p[*str - '0' + NMARKS];
@@ -2551,10 +2537,8 @@ read_viminfo_filemark(vir_T *virp, int f
 prepare_viminfo_marks(void)
 {
     vi_namedfm = ALLOC_CLEAR_MULT(xfmark_T, NMARKS + EXTRA_MARKS);
-#ifdef FEAT_JUMPLIST
     vi_jumplist = ALLOC_CLEAR_MULT(xfmark_T, JUMPLISTSIZE);
     vi_jumplist_len = 0;
-#endif
 }
 
     static void
@@ -2568,14 +2552,12 @@ finish_viminfo_marks(void)
 	    vim_free(vi_namedfm[i].fname);
 	VIM_CLEAR(vi_namedfm);
     }
-#ifdef FEAT_JUMPLIST
     if (vi_jumplist != NULL)
     {
 	for (i = 0; i < vi_jumplist_len; ++i)
 	    vim_free(vi_jumplist[i].fname);
 	VIM_CLEAR(vi_jumplist);
     }
-#endif
 }
 
 /*
@@ -2612,7 +2594,6 @@ handle_viminfo_mark(garray_T *values, in
 
     if (name == '\'')
     {
-#ifdef FEAT_JUMPLIST
 	if (vi_jumplist != NULL)
 	{
 	    if (vi_jumplist_len < JUMPLISTSIZE)
@@ -2667,7 +2648,6 @@ handle_viminfo_mark(garray_T *values, in
 		fm->time_set = 0;
 	    }
 	}
-#endif
     }
     else
     {