comparison src/option.c @ 3894:f69321485951 v7.3.703

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)
author Bram Moolenaar <bram@vim.org>
date Sun, 21 Oct 2012 03:46:05 +0200
parents fd96b3cc88ed
children aab4b29520e7
comparison
equal deleted inserted replaced
3893:c3036f1dca68 3894:f69321485951
7571 7571
7572 #ifdef FEAT_PERSISTENT_UNDO 7572 #ifdef FEAT_PERSISTENT_UNDO
7573 /* 'undofile' */ 7573 /* 'undofile' */
7574 else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) 7574 else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf)
7575 { 7575 {
7576 char_u hash[UNDO_HASH_SIZE]; 7576 /* Only take action when the option was set. When reset we do not
7577 buf_T *save_curbuf = curbuf; 7577 * delete the undo file, the option may be set again without making
7578 7578 * any changes in between. */
7579 for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next) 7579 if (curbuf->b_p_udf || p_udf)
7580 { 7580 {
7581 /* When 'undofile' is set globally: for every buffer, otherwise 7581 char_u hash[UNDO_HASH_SIZE];
7582 * only for the current buffer: Try to read in the undofile, if 7582 buf_T *save_curbuf = curbuf;
7583 * one exists and the buffer wasn't changed and the buffer was 7583
7584 * loaded. */ 7584 for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next)
7585 if ((curbuf == save_curbuf 7585 {
7586 /* When 'undofile' is set globally: for every buffer, otherwise
7587 * only for the current buffer: Try to read in the undofile,
7588 * if one exists, the buffer wasn't changed and the buffer was
7589 * loaded */
7590 if ((curbuf == save_curbuf
7586 || (opt_flags & OPT_GLOBAL) || opt_flags == 0) 7591 || (opt_flags & OPT_GLOBAL) || opt_flags == 0)
7587 && !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL) 7592 && !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL)
7588 { 7593 {
7589 u_compute_hash(hash); 7594 u_compute_hash(hash);
7590 u_read_undo(NULL, hash, curbuf->b_fname); 7595 u_read_undo(NULL, hash, curbuf->b_fname);
7596 }
7591 } 7597 }
7592 } 7598 curbuf = save_curbuf;
7593 curbuf = save_curbuf; 7599 }
7594 } 7600 }
7595 #endif 7601 #endif
7596 7602
7597 /* 'list', 'number' */ 7603 /* 'list', 'number' */
7598 else if ((int *)varp == &curwin->w_p_list 7604 else if ((int *)varp == &curwin->w_p_list