1
0
forked from aniani/vim

updated for version 7.3.703

Problem:    When 'undofile' is reset the hash is computed unnecessarily.
Solution:   Only compute the hash when the option was set. (Christian Brabandt)
This commit is contained in:
Bram Moolenaar
2012-10-21 03:46:05 +02:00
parent 3a0d8090b1
commit e8d8fd2add
2 changed files with 22 additions and 14 deletions

View File

@@ -7572,6 +7572,11 @@ set_bool_option(opt_idx, varp, value, opt_flags)
#ifdef FEAT_PERSISTENT_UNDO #ifdef FEAT_PERSISTENT_UNDO
/* 'undofile' */ /* 'undofile' */
else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf)
{
/* Only take action when the option was set. When reset we do not
* delete the undo file, the option may be set again without making
* any changes in between. */
if (curbuf->b_p_udf || p_udf)
{ {
char_u hash[UNDO_HASH_SIZE]; char_u hash[UNDO_HASH_SIZE];
buf_T *save_curbuf = curbuf; buf_T *save_curbuf = curbuf;
@@ -7579,9 +7584,9 @@ set_bool_option(opt_idx, varp, value, opt_flags)
for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next) for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next)
{ {
/* When 'undofile' is set globally: for every buffer, otherwise /* When 'undofile' is set globally: for every buffer, otherwise
* only for the current buffer: Try to read in the undofile, if * only for the current buffer: Try to read in the undofile,
* one exists and the buffer wasn't changed and the buffer was * if one exists, the buffer wasn't changed and the buffer was
* loaded. */ * loaded */
if ((curbuf == save_curbuf if ((curbuf == save_curbuf
|| (opt_flags & OPT_GLOBAL) || opt_flags == 0) || (opt_flags & OPT_GLOBAL) || opt_flags == 0)
&& !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL) && !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL)
@@ -7592,6 +7597,7 @@ set_bool_option(opt_idx, varp, value, opt_flags)
} }
curbuf = save_curbuf; curbuf = save_curbuf;
} }
}
#endif #endif
/* 'list', 'number' */ /* 'list', 'number' */

View File

@@ -719,6 +719,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
703,
/**/ /**/
702, 702,
/**/ /**/