comparison src/undo.c @ 14327:b8f1167aa8ad v8.1.0179

patch 8.1.0179: redundant condition for boundary check commit https://github.com/vim/vim/commit/efc81331e7bceafa2d7bc452a98d6ec1943b4292 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jul 13 16:31:19 2018 +0200 patch 8.1.0179: redundant condition for boundary check Problem: Redundant condition for boundary check. Solution: Remove the condition. (Dominique Pelle). Change FALSE to FAIL.
author Christian Brabandt <cb@256bit.org>
date Fri, 13 Jul 2018 16:45:05 +0200
parents 3c80092eb211
children 9c9ee53868b9
comparison
equal deleted inserted replaced
14326:19964d1e9f7c 14327:b8f1167aa8ad
264 u_save(linenr_T top, linenr_T bot) 264 u_save(linenr_T top, linenr_T bot)
265 { 265 {
266 if (undo_off) 266 if (undo_off)
267 return OK; 267 return OK;
268 268
269 if (top > curbuf->b_ml.ml_line_count 269 if (top >= bot || bot > curbuf->b_ml.ml_line_count + 1)
270 || top >= bot 270 return FAIL; // rely on caller to give an error message
271 || bot > curbuf->b_ml.ml_line_count + 1)
272 return FALSE; /* rely on caller to do error messages */
273 271
274 if (top + 2 == bot) 272 if (top + 2 == bot)
275 u_saveline((linenr_T)(top + 1)); 273 u_saveline((linenr_T)(top + 1));
276 274
277 return (u_savecommon(top, bot, (linenr_T)0, FALSE)); 275 return (u_savecommon(top, bot, (linenr_T)0, FALSE));