To: vim_dev@googlegroups.com Subject: Patch 7.3.703 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 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) Files: src/option.c *** ../vim-7.3.702/src/option.c 2012-10-21 00:10:29.000000000 +0200 --- src/option.c 2012-10-21 03:42:10.000000000 +0200 *************** *** 7573,7596 **** /* 'undofile' */ else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) { ! char_u hash[UNDO_HASH_SIZE]; ! buf_T *save_curbuf = curbuf; ! ! for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next) { ! /* When 'undofile' is set globally: for every buffer, otherwise ! * only for the current buffer: Try to read in the undofile, if ! * one exists and the buffer wasn't changed and the buffer was ! * loaded. */ ! if ((curbuf == save_curbuf ! || (opt_flags & OPT_GLOBAL) || opt_flags == 0) ! && !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL) { ! u_compute_hash(hash); ! u_read_undo(NULL, hash, curbuf->b_fname); } } - curbuf = save_curbuf; } #endif --- 7573,7602 ---- /* 'undofile' */ 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]; ! buf_T *save_curbuf = curbuf; ! ! for (curbuf = firstbuf; curbuf != NULL; curbuf = curbuf->b_next) { ! /* When 'undofile' is set globally: for every buffer, otherwise ! * only for the current buffer: Try to read in the undofile, ! * if one exists, the buffer wasn't changed and the buffer was ! * loaded */ ! if ((curbuf == save_curbuf ! || (opt_flags & OPT_GLOBAL) || opt_flags == 0) ! && !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL) ! { ! u_compute_hash(hash); ! u_read_undo(NULL, hash, curbuf->b_fname); ! } } + curbuf = save_curbuf; } } #endif *** ../vim-7.3.702/src/version.c 2012-10-21 02:41:04.000000000 +0200 --- src/version.c 2012-10-21 03:43:29.000000000 +0200 *************** *** 721,722 **** --- 721,724 ---- { /* Add new patch number below this line */ + /**/ + 703, /**/ -- Scientists decoded the first message from an alien civilization: SIMPLY SEND 6 TIMES 10 TO THE 50 ATOMS OF HYDROGEN TO THE STAR SYSTEM AT THE TOP OF THE LIST, CROSS OFF THAT STAR SYSTEM, THEN PUT YOUR STAR SYSTEM AT THE BOTTOM OF THE LIST AND SEND IT TO 100 OTHER STAR SYSTEMS. WITHIN ONE TENTH GALACTIC ROTATION YOU WILL RECEIVE ENOUGH HYDROGREN TO POWER YOUR CIVILIZATION UNTIL ENTROPY REACHES ITS MAXIMUM! IT REALLY WORKS! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///